Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Upgrade and Migration Guide

- Previous: Migrating UIF
- Next: Using JDBC 2.0 Data Sources

## Establishing Connections Through the DriverManager Interface

Although this database access method is not recommended, as it is obsolete and is not very effective, there can be some applications that still use this approach.

In this case, the access code is similar to the following:

    public static final String driver = "oracle.jdbc.driver.OracleDriver";
    public static final String url =
      "jdbc:oracle:thin:tmb_user/tmb_user@iben:1521:tmbank";
    Class.forName(driver).newInstance();
    Properties props = new Properties();
    props.setProperty("user", "tmb_user");
    props.setProperty("password", "tmb_user");
    Connection conn = DriverManager.getConnection(url, props);

This code can be fully ported from Application Server 6.x to Application Server, as long as the Application Server is able to locate the classes needed to load the right JDBC driver. In order to make the required classes accessible to the application deployed in the Application Server, place the archive (JAR or ZIP) for the driver implementation in the `/lib` directory of the Application Server installation directory.

Modify the CLASSPATH by setting the path for the driver through the Admin Console GUI.

- Click the server instance “server1.”

- Click the tab “JVM Settings” from the right pane.

- Click the option Path Settings and add the path in the classpath suffix text entry box.

- Once the changes are made, click “Save.”

- Apply the new settings.

- Restart the server to modify the configuration file, `server.xml`.

- Previous: Migrating UIF
- Next: Using JDBC 2.0 Data Sources

- © 2010, Oracle Corporation and/or its affiliates