Progress
JDBC Driver Guide


Connecting to a Database

JDBC applications must perform two steps to connect to a database:

  1. Load the JDBC Driver.
  2. Connect to the Driver.
Loading the JDBC Driver Using Class.forName

The Class.forName method takes as its argument the fully qualified class name of the JDBC Driver. If it finds the class, the method loads and links the class, and returns the Class object representing the class. The fully qualified class name for the Progress SQL-92 JDBC Driver is com.progress.sql.jdbc.JdbcProgressDriver.

To load the JDBC Driver, use it as the argument to the Class.forName method:

SYNTAX 
// Load the driver
Class.forName ("com.progress.sql.jdbc.JdbcProgressDriver"); 

Using DriverManager.GetConnection

To connect to a Progress database through the JDBC Driver, an application specifies:

Applications specify this information as arguments to the DriverManager.GetConnection method.

Java URL Connection String

DriverManager.GetConnection requires at least one argument, a character string specifying a database connection URL. For the Progress SQL-92 JDBC Driver, the URL has the following syntax:

SYNTAX 
jdbc:JdbcProgress:T:host-name:port#:database-name [User-ID password] 

The URL string has the following components:

jdbc:JdbcProgress:T

An identifying subprotocol string for the JDBC Driver.

host-name

The name of the system where the Progress SQL-92 JDBC data source resides.

port#

Port number or service name to be used for the connection.

database-name

The physical file name of the Progress database.

User-ID

The User ID for connecting to the database.

Password

The password for connecting to the database.

EXAMPLE

When passed to DriverManager.GetConnection, the URL jdbc.JdbcProgress:T:isis:2000:testdb specifies that the JDBC Driver be used to connect to the database testdb on the server named isis.

User Authentication Detail

DriverManager.GetConnection accepts three variants of user authentication detail:

NOTE: The JDBC Driver expects the keys of the Properties object to be named user and password when it processes the object. Application code must use those names when it populates the Properties object:

prop.put("user", userid);
prop.put("password", passwd); 

EXAMPLE

The following code sample loads the driver and connects to the database testdb, using the form of DriverManager.GetConnection that takes authentication information as a single Properties object:

String url = "jdbc:JdbcProgress:T:isis:2000:testdb";
String userid = "fred";
String passwd = "fredspasswd";

// Load the driver
Class.forName ("com.progress.sql.JdbcProgressDriver");

// Attempt to connect to a driver.  Each one
// of the registered drivers will be loaded until
// one is found that can process this URL.
java.util.Properties  prop = new java.util.Properties();
prop.put("user", userid);
prop.put("password", passwd);

Connection con = DriverManager.getConnection (url, prop); 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095