skip to main content
Getting started : Connecting from an application : Connecting Using the JDBC Driver Manager
 

Try DataDirect Cloud Now

Connecting Using the JDBC Driver Manager

To use the JDBC Driver manager:
*The driver JAR file must be defined in the application's CLASSPATH.
*Within your application, you need to pass in the connection URL.
Follow these steps to add the driver to a CLASSPATH, register it, and add the appropriate calls in your application:
1. Set your system CLASSPATH to include the driver jar file as shown, where install_dir is the path to your product installation directory:  
Windows Example: CLASSPATH=.;c:\ddcloudjdbc\lib\ddcloud.jar 
UNIX Example: CLASSPATH=.:/home/user1/ddcloudjdbc/lib/ddcloud.jar 
2. Pass the connection URL in the application. The URL includes the user name and password for your DataDirect Cloud connectivity service account and the name of the Data Source defined in the connectivity service. You must also pass in the credentials to the cloud data store if they are not saved in the Data Source:
*This example assumes that the Data Source contains login credentials for the cloud data store, the Data SourceName is myDataSource, myusername and mypassword are the login credentials for the DataDirect Cloud service:
Connection conn = DriverManager.getConnection(
"jdbc:datadirect:ddcloud:DDCloudDataSource=myDataSource", user=myusername,
password=mypassword);
*This example assumes that login credentials are not stored in the Data Source definition, the Data Source name and connectivity service login credentials are the same as the previous example, and the data store user ID and password are test and secret:
Connection conn = DriverManager.getConnection(
"jdbc:datadirect:ddcloud:DDCloudDataSource=myDataSource;
datasourceUserId=test;datasourcePassword=secret",
user=myusername,password=mypassword);
Other connection properties specific to the type of data store are set in the Data Source definition. To modify those, log in to your DataDirect Cloud account.