Class AS400JDBCDriverForcedCcsid
- All Implemented Interfaces:
Driver
To use this driver, the application or caller must register the driver with the JDBC DriverManager. This class also registers itself automatically when it is loaded.
After registering the driver, 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://system-name/default-schema;properties
The driver uses the specified system name to connect to a corresponding IBM i system. If an IPV6 address is used as the system name, it must be enclosed within braces, i.e. [fd13:ac12:18:17::16]. If a system name is not specified, then the user will be prompted.
The default SQL schema is optional and the driver uses it to resolve unqualified names in SQL statements. If no default SQL 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 SQL 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 SQL 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 system mysystem.helloworld.com with mylibrary as the default SQL schema. The connection will use the system naming convention and return full error messages:
jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String(package private) static final String(package private) static final String(package private) static final Stringstatic final intstatic final int(package private) static final int(package private) static final intprivate static final Stringprivate static Driverprivate static ResourceBundleprivate static ResourceBundle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) Indicates if the driver understands how to connect to the database named by the URL.connect(com.ibm.as400.access.AS400 system) Connects to the database on the specified system.connect(com.ibm.as400.access.AS400 system, boolean clone) Connects to the database on the specified system.connect(com.ibm.as400.access.AS400 system, Properties info, String schema) Connects to the database on the specified system.connect(com.ibm.as400.access.AS400 system, Properties info, String schema, boolean clone) Connects to the database on the specified system.connect(String url, Properties info) Connects to the database named by the specified URL.intReturns the driver's major version number.intReturns the driver's minor version number.getPropertyInfo(String url, Properties info) Returns an array of DriverPropertyInfo objects that describe the properties that are supported by this driver.(package private) static StringgetResource(String key, String[] replacementVariables) Returns a resource from the resource bundle.(package private) static com.ibm.as400.access.AS400initializeAS400(com.ibm.as400.access.JDDataSourceURL dataSourceUrl, com.ibm.as400.access.JDProperties jdProperties, Properties info) private ConnectioninitializeConnection(com.ibm.as400.access.AS400 as400) private ConnectioninitializeConnection(com.ibm.as400.access.JDDataSourceURL dataSourceUrl, com.ibm.as400.access.JDProperties jdProperties, Properties info) private ConnectioninitializeConnection(String schema, Properties info, com.ibm.as400.access.AS400 as400) booleanIndicates if the driver is a genuine JDBC compliant driver.private ConnectionprepareConnection(com.ibm.as400.access.AS400 as400, com.ibm.as400.access.JDDataSourceURL dataSourceUrl, Properties info, com.ibm.as400.access.JDProperties jdProperties) (package private) static Stringsubstitute(String text, Object[] values) toString()Returns the name of the driver.
-
Field Details
-
MAJOR_VERSION_
static final int MAJOR_VERSION_- See Also:
-
MINOR_VERSION_
static final int MINOR_VERSION_- See Also:
-
DATABASE_PRODUCT_NAME_
- See Also:
-
DRIVER_NAME_
- See Also:
-
DRIVER_LEVEL_
- See Also:
-
JDBC_MAJOR_VERSION_
public static final int JDBC_MAJOR_VERSION_- See Also:
-
JDBC_MINOR_VERSION_
public static final int JDBC_MINOR_VERSION_- See Also:
-
MRI_NOT_FOUND_
- See Also:
-
resources_
-
resources2_
-
CLASSNAME
- See Also:
-
nativeDriver
-
-
Constructor Details
-
AS400JDBCDriverForcedCcsid
public AS400JDBCDriverForcedCcsid()
-
-
Method Details
-
acceptsURL
Indicates if the driver understands how to connect to the database named by the URL.- Specified by:
acceptsURLin interfaceDriver- Parameters:
url- The URL for the database.- Returns:
- true if the driver understands how to connect to the database; false otherwise.
- Throws:
SQLException- If an error occurs.
-
connect
Connects to the database named by the specified URL. There are many optional properties that can be specified. Properties can be specified either as part of the URL or in a java.util.Properties object. See JDBC properties for a complete list of properties supported by this driver.- Specified by:
connectin interfaceDriver- Parameters:
url- The URL for the database.info- The connection properties.- Returns:
- The connection to the database or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If the driver is unable to make the connection.
-
connect
Connects to the database on the specified system.Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect(o);
- Parameters:
system- The IBM i system to connect.- Returns:
- The connection to the database or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If the driver is unable to make the connection.
-
connect
Connects to the database on the specified system.Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect(o, false);
- Parameters:
system- The IBM i system to connect.clone- True if the AS400 object should be cloned, false otherwise.- Returns:
- The connection to the database or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If the driver is unable to make the connection.
-
connect
public Connection connect(com.ibm.as400.access.AS400 system, Properties info, String schema, boolean clone) throws SQLException Connects to the database on the specified system.Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); String mySchema = "defaultSchema"; Properties prop = new Properties(); Connection c = d.connect(o, prop, mySchema, false);
- Parameters:
system- The IBM i system to connect.info- The connection properties.schema- The default SQL schema or null meaning no default SQL schema specified.clone- True if the AS400 object should be cloned, false otherwise.- Returns:
- The connection to the database or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If the driver is unable to make the connection.
-
connect
public Connection connect(com.ibm.as400.access.AS400 system, Properties info, String schema) throws SQLException Connects to the database on the specified system. There are many optional properties that can be specified. Properties can be specified in a java.util.Properties object. See JDBC properties for a complete list of properties supported by this driver.Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); String mySchema = "defaultSchema"; Properties p = new Properties(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect(o, p, mySchema);
- Parameters:
system- The IBM i system to connect.info- The connection properties.schema- The default SQL schema or null meaning no default SQL schema specified.- Returns:
- The connection to the database or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If the driver is unable to make the connection.
-
getMajorVersion
public int getMajorVersion()Returns the driver's major version number.- Specified by:
getMajorVersionin interfaceDriver- Returns:
- The major version number.
-
getMinorVersion
public int getMinorVersion()Returns the driver's minor version number.- Specified by:
getMinorVersionin interfaceDriver- Returns:
- The minor version number.
-
getPropertyInfo
Returns an array of DriverPropertyInfo objects that describe the properties that are supported by this driver.- Specified by:
getPropertyInfoin interfaceDriver- Parameters:
url- The URL for the database.info- The connection properties.- Returns:
- The descriptions of all possible properties or null if the driver does not understand how to connect to the database.
- Throws:
SQLException- If an error occurs.
-
getResource
Returns a resource from the resource bundle.- Parameters:
key- The resource key.replacementVariables- -- replacement variables for the message- Returns:
- The resource String.
-
substitute
-
initializeAS400
static com.ibm.as400.access.AS400 initializeAS400(com.ibm.as400.access.JDDataSourceURL dataSourceUrl, com.ibm.as400.access.JDProperties jdProperties, Properties info) throws SQLException - Throws:
SQLException
-
initializeConnection
private Connection initializeConnection(com.ibm.as400.access.JDDataSourceURL dataSourceUrl, com.ibm.as400.access.JDProperties jdProperties, Properties info) throws SQLException - Throws:
SQLException
-
initializeConnection
- Throws:
SQLException
-
initializeConnection
private Connection initializeConnection(String schema, Properties info, com.ibm.as400.access.AS400 as400) throws SQLException - Throws:
SQLException
-
jdbcCompliant
public boolean jdbcCompliant()Indicates if the driver is a genuine JDBC compliant driver.- Specified by:
jdbcCompliantin interfaceDriver- Returns:
- Always true.
-
prepareConnection
private Connection prepareConnection(com.ibm.as400.access.AS400 as400, com.ibm.as400.access.JDDataSourceURL dataSourceUrl, Properties info, com.ibm.as400.access.JDProperties jdProperties) throws SQLException - Throws:
SQLException
-
toString
Returns the name of the driver. -
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver- Throws:
SQLFeatureNotSupportedException
-