com.ibm.as400.micro
Class JdbcMeDriver

java.lang.Object
  extended bycom.ibm.as400.micro.JdbcMeDriver

public class JdbcMeDriver
extends Object

The JdbcMeDriver class is a driver that accesses DB2 for OS/400 databases.

This class registers itself automatically when it is loaded. To use the iSeries Developer Kit for Java Native JDBC driver, specify the "driver=native" on the url.

Applications make connection requests to the DriverManager, which dispatches them to the appropriate driver. This driver accepts connection requests for databases specified by the URLs that match the following syntax:

  jdbc:as400://server-name/default-schema;meserver=<server>[:port];[other properties];
  
Additionally, for the JdbcMe driver, if the port is unspecified, the port number 3470 is used.

The driver uses the specified server name to connect to a corresponding iSeries server. If a server name is not specified, an exception will occur. If a userid or password is not specified via the url or by using the getConnection(url, userid, password) method, an exception will occur.

The default schema is optional and the driver uses it to resolve unqualified names in SQL statements. If no default schema is set, then the driver resolves unqualified names based on the naming convention for the connection. If SQL naming is being used, and no default schema is set, then the driver resolves unqualified names using the schema with the same name as the user. If system naming is being used, and no default schema is set, then the driver resolves unqualified names using the server job's library list. See JDBC properties for more details on how to set the naming convention and library list.

Several properties can optionally be set within the URL. They are separated by semicolons and are in the form:

  name1=value1;name2=value2;...
  
See JDBC properties for a complete list of properties supported by this driver.

The following example URL specifies a connection to the database on server mysystem.helloworld.com with mylibrary as the default schema. The connection will use the system naming convention, return full error messages, and connect to the iSeries through the specified MEServer myMeServer:

  jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full;meserver=myMeServer;
  

Note: Since Java 2 Micro-Edition does not include java.sql, JdbcMeDriver implements the java.sql package that is also part of this driver.

See Also:
MEServer

Method Summary
static Connection getConnection(String url)
          Connects to the database named by the specified URL.
static Connection getConnection(String url, String user, String password)
          The JdbcMe driver supports URLs of the following form: "jdbc:<subprotocol>:<target-db-specification>;meserver=<server>[:port]" The subprotocol and target-db-specification is specified as required by the target JDBC driver being used on the JdbcMe host server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public static Connection getConnection(String url)
                                throws JdbcMeException
Connects to the database named by the specified URL. See JDBC properties for a complete list of properties supported by this driver.

Note: The java.sql.DriverManager doesn't support drivers other than JdbcMe

Returns:
The connection to the database or null if the driver does not understand how to connect to the database.
Throws:
JdbcMeException - If the driver is unable to make the connection.
See Also:
getConnection(String, String, String)

getConnection

public static Connection getConnection(String url,
                                       String user,
                                       String password)
                                throws JdbcMeException
The JdbcMe driver supports URLs of the following form: "jdbc:<subprotocol>:<target-db-specification>;meserver=<server>[:port]" The subprotocol and target-db-specification is specified as required by the target JDBC driver being used on the JdbcMe host server.

Additionally, for the JdbcMe driver, if the port is unspecified, the port number 3470 is used.

The meserver property is used to find the MEServer. All other values/properties are passed through to the Jdbc driver used by the target MEServer.

Note: The java.sql.DriverManager doesn't support drivers other than JdbcMe.

Parameters:
url - The URL for the database.
user - The user on whose behalf the connection is being made.
password - The user's password.
Throws:
JdbcMeException - If the driver is unable to make the connection.