Try OpenEdge Now
skip to main content
SQL Development
JDBC Client : Connecting to an OpenEdge database with a JDBC driver : Connecting from a Java application using a URL
 

Connecting from a Java application using a URL

A Java application must perform two steps to connect to an OpenEdge database through a JDBC driver:
1. It must load the JDBC driver.
2. It must connect to the JDBC driver
To load the JDBC driver, call the Class.forName method in the JDBC application. The Class.forName method takes the fully qualified class name of the JDBC driver as its argument. The fully qualified class name for the JDBC driver is com.ddtek.jdbc.openedge.OpenEdgeDriver.
This class name is case-sensitive and must be typed exactly as shown. The Class.forName method also registers the specified JDBC driver with the Driver Manager class so that the driver is available for connections.
Here is an example of the call needed to load and register the driver:
CLASS.FORNAME ( "com.ddtek.jdbc.openedge.OpenEdgeDriver");
Now that the JDBC driver has been loaded and registered, the DriverManager.getConnection method must be called to establish a connection to the database. The getConnection method takes three arguments:
*A string containing a URL. The Driver Manager uses this URL to find a driver that can connect to the database represented by the given URL. Once the driver is found, the URL is used by the Driver class to establish the connection to the database.
OpenEdge syntax for the URL string is:
jdbc:datadirect:openedge://host:port;databaseName=db_name;
servicename=service_name;defaultSchema=schema_name;
statementCacheSize=Cachesize;
See the JDBC URL connection string in the following section for an explanation of each component.
*The ID of the user trying to connect to the database.
*The user's password.
* Database connection examples