Registering the JDBC driver

Before using JDBC to access data in an AS/400 database file, you need to register the JDBC driver for the AS/400 Toolbox for Java licensed program with the DriverManager. You can register the driver either by using a Java system property or by having the Java program register the driver:

      "-Djdbc.drivers=com.ibm.as400.access.AS400JDBCDriver"
      java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());

The AS/400 Toolbox for Java JDBC driver does not require an AS400 object as an input parameter like the other AS/400 Toolbox for Java classes that get data from an AS/400. An AS400 object is used internally, however, to manage default user and password caching. When a connection is first made to the AS/400, the user may be prompted for user ID and password. The user has the option to save the user ID as the default user ID and add the password to the password cache. As in the other AS/400 Toolbox for Java functions, if the user ID and password are supplied by the Java program, the default user is not set and the password is not cached. See managing connections for information on managing connections.