0% found this document useful (0 votes)
100 views

Quick Start: Progress Datadirect Connect: Connecting To A Database

Progress(r) datadirect Connect(r) for jdbc drivers can be used with the JDBC Driver Manager or with a JNDI data source. The following sections provide information you need to get started using the drivers with the Driver Manager. The classname and connection URL syntax for the DB2 driver are: Driver Classname: Connection URL: com.ddtek.jdbc.db2.db2.

Uploaded by

gpeev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Quick Start: Progress Datadirect Connect: Connecting To A Database

Progress(r) datadirect Connect(r) for jdbc drivers can be used with the JDBC Driver Manager or with a JNDI data source. The following sections provide information you need to get started using the drivers with the Driver Manager. The classname and connection URL syntax for the DB2 driver are: Driver Classname: Connection URL: com.ddtek.jdbc.db2.db2.

Uploaded by

gpeev
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Quick Start: Progress DataDirect Connect for JDBC

The following basic information allows you to connect with and test your Progress DataDirect Connect for JDBC drivers immediately after installation. For installation instructions, refer to the DataDirect Connect for JDBC Installation Guide.

Connecting to a Database
Once the DataDirect Connect for JDBC drivers are installed, you can connect from your application to your database in two ways: with the JDBC Driver Manager or with a JNDI data source. The following sections provide information you need to get started using the DataDirect Connect for JDBC drivers with the Driver Manager. For information on using data sources, refer to the DataDirect Connect for JDBC User's Guide. Click the following links for specific information about each driver: DB2 Driver Informix Driver MySQL Driver Oracle Driver SQL Server Driver Sybase Driver

DB2 Driver
Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/db2.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a Java Virtual Machine (JVM), you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the DB2 driver are: Driver Classname: Connection URL: com.ddtek.jdbc.db2.DB2Driver DB2 for Linux/UNIX/Windows: jdbc:datadirect:db2://servername:port;DatabaseName=db_name [;property=value[;...]] DB2 for z/OS and iSeries: jdbc:datadirect:db2://servername:port;LocationName=location_name [;property=value[;...]] For example, to connect to a DB2 for Linux/UNIX/Windows database named ACCTNG on the server named corpserver1 on port 50000, the following URL would be used: jdbc:datadirect:db2://corpserver1:50000;DatabaseName=ACCTNG

Similarly, to connect to a DB2 for z/OS or iSeries database with a location name of ACCTNG on the server named corpserver1 on port 50000, the following URL would be used: jdbc:datadirect:db2://corpserver1:50000;LocationName=ACCTNG Refer to the DataDirect Connect for JDBC Users Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Examples
DB2 for Linux/UNIX/Windows: // Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.db2.DB2Driver"); // Establish the Connection String url = "jdbc:datadirect:db2://corpserver1:50000;DatabaseName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion()); DB2 UDB for z/OS and iSeries: // Register the driver with the driver manager // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.db2.DB2Driver"); // Establish the Connection String url = "jdbc:datadirect:db2://corpserver1:50000;LocationName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

Informix Driver
Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/informix.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a JVM, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the Informix driver are: Driver Classname: Connection URL: com.ddtek.jdbc.informix.InformixDriver jdbc:datadirect:informix://servername:port;InformixServer=server_name [;property=value[;...]]]

For example, to connect to a database named ACCTNG in the Informix server instance named corpSrvr on the server named corpserver1 on port 2003, the following URL would be used: jdbc:datadirect:informix://corpserver1:2003;InformixServer=corpSrvr; DatabaseName=ACCTNG Refer to the DataDirect Connect for JDBC Users Guide for a complete description of the connection URL syntax and a description of the connection properties that can be specified.

Example
// Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.informix.InformixDriver"); // Establish the Connection String url = "jdbc:datadirect:informix://corpserver1:2003; InformixServer=corpSrvr;DatabaseName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

MySQL Driver
Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/mysql.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a JVM, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the MySQL driver are: Driver Classname: Connection URL: com.ddtek.jdbc.mysql.MySQLDriver jdbc:datadirect:mysql://hostname:[port][;property=value[;...]]

For example, to connect to a database named ACCTNG on the server named corpserver1 on port 3306, the following URL would be used: jdbc:datadirect:mysql://corpserver1:3306;DatabaseName=ACCTNG Refer to the DataDirect Connect for JDBC User's Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Example
// Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.mysql.MySQLDriver"); // Establish the Connection String url = "jdbc:datadirect:mysql://corpserver1:3306;DatabaseName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

Oracle Driver
Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/oracle.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a JVM, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the Oracle driver are: Driver Classname: Connection URL: com.ddtek.jdbc.oracle.OracleDriver jdbc:datadirect:oracle://servername:port;[;property=value [;...]]

For example, to connect to Oracle instance named test on the server named corpserver1 on port 1521, the following URL would be used: jdbc:datadirect:oracle://corpserver1:1521;ServiceName=test Refer to the DataDirect Connect for JDBC Users Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Example
// Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.oracle.OracleDriver"); // Establish the Connection String url = "jdbc:datadirect:oracle://corpserver1:1521;ServiceName=test"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

SQL Server Driver


Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/sqlserver.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a JVM, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the SQL Server driver are: Driver Classname: Connection URL: com.ddtek.jdbc.sqlserver.SQLServerDriver jdbc:datadirect:sqlserver://servername:port[;property=value [;...]]

For example, to connect to a database named ACCTNG on the server named corpserver1 on port 1433, the following URL would be used: jdbc:datadirect:sqlserver://corpserver1:1433;DatabaseName=ACCTNG Refer to the DataDirect Connect for JDBC Users Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Example
// Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.sqlserver.SQLServerDriver"); // Establish the Connection String url = "jdbc:datadirect:sqlserver://corpserver1:1433; DatabaseName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

Sybase Driver
Environment Setup
Set your system CLASSPATH to include the following entry: install_dir/lib/sybase.jar

Driver Manager
To establish a database connection using the Driver Manager, an application must register the class name of the JDBC driver with the Driver Manager, and then invoke the DriverManager.getConnection() method while supplying a connection URL. IMPORTANT: If using Java SE 6 as a JVM, you do not need to register the driver and can skip this step. Java SE 6 automatically registers the driver with the JDBC Driver Manager. The classname and connection URL syntax for the Sybase driver are: Driver Classname: Connection URL: com.ddtek.jdbc.sybase.SybaseDriver jdbc:datadirect:sybase://servername:port[;property=value [;...]]

For example, to connect to a database named ACCTNG on the server named corpserver1 on port 4100, the following URL would be used: jdbc:datadirect:sybase://corpserver1:4100;DatabaseName=ACCTNG Refer to the DataDirect Connect for JDBC Users Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Example
// Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. Class.forName("com.ddtek.jdbc.sybase.SybaseDriver"); // Establish the Connection String url = "jdbc:datadirect:sybase://corpserver1:4100;DatabaseName=ACCTNG"; Connection con = DriverManager.getConnection(url, "test04", "test04"); // Verify the Connection DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " + metaData.getDatabaseProductName()); System.out.println("Database Version: " + metaData.getDatabaseProductVersion());

Tuning Drivers for Optimal Performance


To tune a driver for optimal performance, run the DataDirect Connect for JDBC Performance Tuning Wizard. The Wizard is installed with the product and is also available from the DataDirect Progress web site (http://web.datadirect.com/products/jdbc/wizard-agreement.html). The Performance Tuning Wizard leads you step-by-step through a series of questions about your application. Based on your answers, the Wizard provides the optimal settings for performance-related connection properties. The Wizard runs as an applet within a browser window. To start the Wizard that was installed with the product, launch the following file from your browser, where install_dir is your DataDirect Connect for JDBC installation directory: install_dir/wizards/index.html NOTE: Security features set in your browser can prevent the Performance Wizard from launching. A security warning message is displayed. Often, the warning message provides instructions for unblocking the Performance Wizard for the current session. To allow the Performance Wizard to launch without encountering a security warning message, the security settings in your browser can be modified. Check with your system administrator before disabling any security features.

Testing the Connection


DataDirect Test for JDBC is a pure java JDBC testing tool developed by Progress DataDirect and distributed with DataDirect Connect for JDBC. For more information about DataDirect Test for JDBC, refer to the DataDirect Connect for JDBC Reference. Use the following steps to test your connection: 1. Start DataDirect Test for JDBC by running testforjdbc.bat or testforjdbc.sh in the install_dir/testforjdbc directory, where install_dir is your installation directory. 2. Click Press Here to Continue. 3. From the Connection menu, select Connect to DB. 4. Select the appropriate template for your database, and specify the correct server name, Informix server name (if testing an Informix connection), port, and database name. Click OK. 5. A new connection window opens if all of the connection information was entered correctly. If the connection cannot be established, an error is displayed in the JDBC/Database Output window.

2010. Progress Software Corporation. All rights reserved.

7/10

You might also like