Corda.com

 

Importing Data from a ODBC-driven Database

< BACK TO DATA SOURCES

Using Corda Server's ability to connect to a Windows ODBC data sources, you import data automatically into graphs and maps from just about any database. This functionality is available in ASP, ASP.NET, and ColdFusion (on Windows) applications.

All you have to do is specify a database name and SQL query, and the Corda Embedder will automatically execute your query and send the resulting data to Corda Server. You can do this using Corda Embedder�s setDBQuery() or setMapDBQuery() method.

For example, consider the following scenario:

  • Your graph object (in the appearance file) is named graph.
  • You�ve set up an ODBC data source named bcdemo on the computer where your web application is located.
  • Your user name and password are user and password.
  • Your SQL query is �Select Description, OnHand from parts order by Description�.

You could have Corda Embedder execute this query and send the resulting data set to Corda Server using the following command:

myImage.setDBQuery "graph", "", "bcdemo", "user�, "password", "Select Description, OnHand from parts order by Description"

Likewise, suppose you wanted to send the same data set to the background shapes (states) in a map named US. To do so, you would use the following command:

myImage.setMapDBQuery "US", "Areas", "", "bcdemo", "user�, "password", "Select Description, OnHand from parts order by Description"

You can also make a DSN-less connection to a database. In such cases, in place of a database name (e.g. bcdemo), you would enter a string containing all of the parameters necessary to identify your database. The actual syntax of this string will depend on the database, but may look something like this:

Provider=SQLOLEDB.1;Password=MyPassword;Persist Security Info=True;User ID=MyUserID;Initial Catalog=Northwind;Data Source=MyDataServer

For more information about connecting to ODBC driven databases, consult Chapter 6 of the PopChart and OptiMap Web Development manual.

To see complete example applications illustrating ODBC data connections, view your web environment below:

Web Environment Application Code Examples
ASP PopChart Dynamic Graphs
ASP.NET PopChart Dynamic Graphs
ColdFusion PopChart Dynamic Graphs