Connect from a Java application using a URL
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
A Java application must perform two steps to connect to an OpenEdge database through a JDBC driver:
- It must load the JDBC driver.
- 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:
|
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:
|
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.