org.apache.ojb.broker.metadata
Class JdbcMetadataUtils

java.lang.Object
  extended by org.apache.ojb.broker.metadata.JdbcMetadataUtils

public class JdbcMetadataUtils
extends java.lang.Object

This class provides some utility functions to OJB for working with JDBC metadata.

Author:
Thomas Dudziak

Field Summary
static java.lang.String DRIVER_DB2
          The standard DB2 jdbc driver
static java.lang.String DRIVER_DB2_INET
          The i-net DB2 jdbc driver
static java.lang.String DRIVER_FIREBIRD
          The standard Firebird jdbc driver
static java.lang.String DRIVER_HSQLDB
          The standard Hsqldb jdbc driver
static java.lang.String DRIVER_INET_POOLED
          The i-net pooled jdbc driver for SQLServer and Sybase
static java.lang.String DRIVER_INFORMIX
          The standard Informix jdbc driver
static java.lang.String DRIVER_JTDS
          The jTDS jdbc driver for SQLServer and Sybase
static java.lang.String DRIVER_MAXDB
          The standard MaxDB jdbc driver
static java.lang.String DRIVER_MCKOI
          The standard McKoi jdbc driver
static java.lang.String DRIVER_MSSQLSERVER
          The standard SQLServer jdbc driver
static java.lang.String DRIVER_MSSQLSERVER_INET
          The i-net SQLServer jdbc driver
static java.lang.String DRIVER_MSSQLSERVER_JSQLCONNECT
          The JNetDirect SQLServer jdbc driver
static java.lang.String DRIVER_MYSQL
          The standard MySQL jdbc driver
static java.lang.String DRIVER_MYSQL_OLD
          The old MySQL jdbc driver
static java.lang.String DRIVER_ORACLE
          The standard Oracle jdbc driver
static java.lang.String DRIVER_ORACLE_INET
          The i-net Oracle jdbc driver
static java.lang.String DRIVER_POSTGRESQL
          The standard PostgreSQL jdbc driver
static java.lang.String DRIVER_SAPDB
          The standard Sapdb jdbc driver
static java.lang.String DRIVER_SYBASE
          The standard Sybase jdbc driver
static java.lang.String DRIVER_SYBASE_INET
          The i-net Sybase jdbc driver
static java.lang.String DRIVER_SYBASE_OLD
          The old Sybase jdbc driver
static java.lang.String PLATFORM_DB2
          Identifier for the DB2 platform
static java.lang.String PLATFORM_FIREBIRD
          Identifier for the Firebird platform
static java.lang.String PLATFORM_HSQLDB
          Identifier for the Hsqldb platform
static java.lang.String PLATFORM_INFORMIX
          Identifier for the Informix platform
static java.lang.String PLATFORM_MAXDB
          Identifier for the MaxDB platform
static java.lang.String PLATFORM_MCKOI
          Identifier for the McKoi platform
static java.lang.String PLATFORM_MSACCESS
          Identifier for the MsAccess platform
static java.lang.String PLATFORM_MSSQLSERVER
          Identifier for the Microsoft SQL Server platform
static java.lang.String PLATFORM_MYSQL
          Identifier for the MySQL platform
static java.lang.String PLATFORM_ORACLE
          Identifier for the generic Oracle platform
static java.lang.String PLATFORM_ORACLE9I
          Identifier for the Oracle9i platform
static java.lang.String PLATFORM_POSTGRESQL
          Identifier for the PostgresSQL platform
static java.lang.String PLATFORM_SYBASE
          Identifier for the generic Sybase platform
static java.lang.String PLATFORM_SYBASEASA
          Identifier for the Sybase ASA platform
static java.lang.String PLATFORM_SYBASEASE
          Identifier for the Sybase ASE platform
static java.lang.String PLATFORM_WLORACLE9I
          Identifier for the Oracle9i for WebLogic platform
static java.lang.String PROPERTY_DBALIAS
          The name of the property returned by the #splitConnectionUrl(String) method that contains the database alias (the actual database url)
static java.lang.String PROPERTY_PROTOCOL
          The name of the property returned by the #splitConnectionUrl(String) method that contains the protocol
static java.lang.String PROPERTY_SUBPROTOCOL
          The name of the property returned by the #splitConnectionUrl(String) method that contains the sub protocol
static java.lang.String SUBPROTOCOL_DB2
          The subprotocol used by the standard DB2 driver
static java.lang.String SUBPROTOCOL_DB2_INET
          The subprotocol used by the i-net DB2 driver
static java.lang.String SUBPROTOCOL_FIREBIRD
          The subprotocol used by the standard Firebird driver
static java.lang.String SUBPROTOCOL_HSQLDB
          The subprotocol used by the standard Hsqldb driver
static java.lang.String SUBPROTOCOL_INFORMIX
          The subprotocol used by the standard Informix driver
static java.lang.String SUBPROTOCOL_MAXDB
          The subprotocol used by the standard MaxDB driver
static java.lang.String SUBPROTOCOL_MCKOI
          The subprotocol used by the standard McKoi driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER
          The subprotocol used by the standard SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER_INET
          A subprotocol used by the i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER_JSQLCONNECT
          The subprotocol used by the JNetDirect SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER_JTDS
          The subprotocol used by the jTDS SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER6_INET
          A subprotocol used by the i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER6_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER7_INET
          A subprotocol used by the i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER7_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER7A_INET
          A subprotocol used by the i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MSSQLSERVER7A_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static java.lang.String SUBPROTOCOL_MYSQL
          The subprotocol used by the standard MySQL driver
static java.lang.String SUBPROTOCOL_ORACLE
          The subprotocol used by the standard Oracle driver
static java.lang.String SUBPROTOCOL_ORACLE_INET
          The subprotocol used by the i-net Oracle driver
static java.lang.String SUBPROTOCOL_POSTGRESQL
          The subprotocol used by the standard PostgreSQL driver
static java.lang.String SUBPROTOCOL_SAPDB
          The subprotocol used by the standard Sapdb driver
static java.lang.String SUBPROTOCOL_SYBASE
          The subprotocol used by the standard Sybase driver
static java.lang.String SUBPROTOCOL_SYBASE_INET
          The subprotocol used by the i-net Sybase driver
static java.lang.String SUBPROTOCOL_SYBASE_INET_POOLED
          The subprotocol used by the pooled i-net Sybase driver
static java.lang.String SUBPROTOCOL_SYBASE_JTDS
          The subprotocol used by the jTDS Sybase driver
 
Constructor Summary
JdbcMetadataUtils()
          Creates a new JdbcMetadataUtils object.
 
Method Summary
 void fillJCDFromDataSource(JdbcConnectionDescriptor jcd, javax.sql.DataSource dataSource, java.lang.String username, java.lang.String password)
          Fills parameters of the given JdbcConnectionDescriptor with metadata extracted from the given datasource.
 java.lang.String findPlatformFor(java.lang.String jdbcSubProtocol, java.lang.String jdbcDriver)
          Derives the OJB platform to use for a database that is connected via a url using the specified subprotocol, and where the specified jdbc driver is used.
 java.util.HashMap parseConnectionUrl(java.lang.String jdbcConnectionUrl)
          Splits the given jdbc connection url into its components and puts them into a hash map using the PROPERTY_ constants.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PROTOCOL

public static final java.lang.String PROPERTY_PROTOCOL
The name of the property returned by the #splitConnectionUrl(String) method that contains the protocol

See Also:
Constant Field Values

PROPERTY_SUBPROTOCOL

public static final java.lang.String PROPERTY_SUBPROTOCOL
The name of the property returned by the #splitConnectionUrl(String) method that contains the sub protocol

See Also:
Constant Field Values

PROPERTY_DBALIAS

public static final java.lang.String PROPERTY_DBALIAS
The name of the property returned by the #splitConnectionUrl(String) method that contains the database alias (the actual database url)

See Also:
Constant Field Values

PLATFORM_DB2

public static final java.lang.String PLATFORM_DB2
Identifier for the DB2 platform

See Also:
Constant Field Values

PLATFORM_FIREBIRD

public static final java.lang.String PLATFORM_FIREBIRD
Identifier for the Firebird platform

See Also:
Constant Field Values

PLATFORM_HSQLDB

public static final java.lang.String PLATFORM_HSQLDB
Identifier for the Hsqldb platform

See Also:
Constant Field Values

PLATFORM_INFORMIX

public static final java.lang.String PLATFORM_INFORMIX
Identifier for the Informix platform

See Also:
Constant Field Values

PLATFORM_MAXDB

public static final java.lang.String PLATFORM_MAXDB
Identifier for the MaxDB platform

See Also:
Constant Field Values

PLATFORM_MCKOI

public static final java.lang.String PLATFORM_MCKOI
Identifier for the McKoi platform

See Also:
Constant Field Values

PLATFORM_MSACCESS

public static final java.lang.String PLATFORM_MSACCESS
Identifier for the MsAccess platform

See Also:
Constant Field Values

PLATFORM_MSSQLSERVER

public static final java.lang.String PLATFORM_MSSQLSERVER
Identifier for the Microsoft SQL Server platform

See Also:
Constant Field Values

PLATFORM_MYSQL

public static final java.lang.String PLATFORM_MYSQL
Identifier for the MySQL platform

See Also:
Constant Field Values

PLATFORM_ORACLE

public static final java.lang.String PLATFORM_ORACLE
Identifier for the generic Oracle platform

See Also:
Constant Field Values

PLATFORM_ORACLE9I

public static final java.lang.String PLATFORM_ORACLE9I
Identifier for the Oracle9i platform

See Also:
Constant Field Values

PLATFORM_POSTGRESQL

public static final java.lang.String PLATFORM_POSTGRESQL
Identifier for the PostgresSQL platform

See Also:
Constant Field Values

PLATFORM_SYBASE

public static final java.lang.String PLATFORM_SYBASE
Identifier for the generic Sybase platform

See Also:
Constant Field Values

PLATFORM_SYBASEASA

public static final java.lang.String PLATFORM_SYBASEASA
Identifier for the Sybase ASA platform

See Also:
Constant Field Values

PLATFORM_SYBASEASE

public static final java.lang.String PLATFORM_SYBASEASE
Identifier for the Sybase ASE platform

See Also:
Constant Field Values

PLATFORM_WLORACLE9I

public static final java.lang.String PLATFORM_WLORACLE9I
Identifier for the Oracle9i for WebLogic platform

See Also:
Constant Field Values

DRIVER_DB2

public static final java.lang.String DRIVER_DB2
The standard DB2 jdbc driver

See Also:
Constant Field Values

DRIVER_DB2_INET

public static final java.lang.String DRIVER_DB2_INET
The i-net DB2 jdbc driver

See Also:
Constant Field Values

DRIVER_FIREBIRD

public static final java.lang.String DRIVER_FIREBIRD
The standard Firebird jdbc driver

See Also:
Constant Field Values

DRIVER_HSQLDB

public static final java.lang.String DRIVER_HSQLDB
The standard Hsqldb jdbc driver

See Also:
Constant Field Values

DRIVER_INET_POOLED

public static final java.lang.String DRIVER_INET_POOLED
The i-net pooled jdbc driver for SQLServer and Sybase

See Also:
Constant Field Values

DRIVER_INFORMIX

public static final java.lang.String DRIVER_INFORMIX
The standard Informix jdbc driver

See Also:
Constant Field Values

DRIVER_JTDS

public static final java.lang.String DRIVER_JTDS
The jTDS jdbc driver for SQLServer and Sybase

See Also:
Constant Field Values

DRIVER_MAXDB

public static final java.lang.String DRIVER_MAXDB
The standard MaxDB jdbc driver

See Also:
Constant Field Values

DRIVER_MCKOI

public static final java.lang.String DRIVER_MCKOI
The standard McKoi jdbc driver

See Also:
Constant Field Values

DRIVER_MSSQLSERVER

public static final java.lang.String DRIVER_MSSQLSERVER
The standard SQLServer jdbc driver

See Also:
Constant Field Values

DRIVER_MSSQLSERVER_INET

public static final java.lang.String DRIVER_MSSQLSERVER_INET
The i-net SQLServer jdbc driver

See Also:
Constant Field Values

DRIVER_MSSQLSERVER_JSQLCONNECT

public static final java.lang.String DRIVER_MSSQLSERVER_JSQLCONNECT
The JNetDirect SQLServer jdbc driver

See Also:
Constant Field Values

DRIVER_MYSQL

public static final java.lang.String DRIVER_MYSQL
The standard MySQL jdbc driver

See Also:
Constant Field Values

DRIVER_MYSQL_OLD

public static final java.lang.String DRIVER_MYSQL_OLD
The old MySQL jdbc driver

See Also:
Constant Field Values

DRIVER_ORACLE

public static final java.lang.String DRIVER_ORACLE
The standard Oracle jdbc driver

See Also:
Constant Field Values

DRIVER_ORACLE_INET

public static final java.lang.String DRIVER_ORACLE_INET
The i-net Oracle jdbc driver

See Also:
Constant Field Values

DRIVER_POSTGRESQL

public static final java.lang.String DRIVER_POSTGRESQL
The standard PostgreSQL jdbc driver

See Also:
Constant Field Values

DRIVER_SAPDB

public static final java.lang.String DRIVER_SAPDB
The standard Sapdb jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE

public static final java.lang.String DRIVER_SYBASE
The standard Sybase jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE_OLD

public static final java.lang.String DRIVER_SYBASE_OLD
The old Sybase jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE_INET

public static final java.lang.String DRIVER_SYBASE_INET
The i-net Sybase jdbc driver

See Also:
Constant Field Values

SUBPROTOCOL_DB2

public static final java.lang.String SUBPROTOCOL_DB2
The subprotocol used by the standard DB2 driver

See Also:
Constant Field Values

SUBPROTOCOL_DB2_INET

public static final java.lang.String SUBPROTOCOL_DB2_INET
The subprotocol used by the i-net DB2 driver

See Also:
Constant Field Values

SUBPROTOCOL_FIREBIRD

public static final java.lang.String SUBPROTOCOL_FIREBIRD
The subprotocol used by the standard Firebird driver

See Also:
Constant Field Values

SUBPROTOCOL_HSQLDB

public static final java.lang.String SUBPROTOCOL_HSQLDB
The subprotocol used by the standard Hsqldb driver

See Also:
Constant Field Values

SUBPROTOCOL_INFORMIX

public static final java.lang.String SUBPROTOCOL_INFORMIX
The subprotocol used by the standard Informix driver

See Also:
Constant Field Values

SUBPROTOCOL_MAXDB

public static final java.lang.String SUBPROTOCOL_MAXDB
The subprotocol used by the standard MaxDB driver

See Also:
Constant Field Values

SUBPROTOCOL_MCKOI

public static final java.lang.String SUBPROTOCOL_MCKOI
The subprotocol used by the standard McKoi driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER
The subprotocol used by the standard SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_INET

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER_INET
A subprotocol used by the i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER6_INET

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER6_INET
A subprotocol used by the i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7_INET

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER7_INET
A subprotocol used by the i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7A_INET

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER7A_INET
A subprotocol used by the i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_INET_POOLED

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER_INET_POOLED
A subprotocol used by the pooled i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER6_INET_POOLED

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER6_INET_POOLED
A subprotocol used by the pooled i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7_INET_POOLED

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER7_INET_POOLED
A subprotocol used by the pooled i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7A_INET_POOLED

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER7A_INET_POOLED
A subprotocol used by the pooled i-net SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_JSQLCONNECT

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER_JSQLCONNECT
The subprotocol used by the JNetDirect SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_JTDS

public static final java.lang.String SUBPROTOCOL_MSSQLSERVER_JTDS
The subprotocol used by the jTDS SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MYSQL

public static final java.lang.String SUBPROTOCOL_MYSQL
The subprotocol used by the standard MySQL driver

See Also:
Constant Field Values

SUBPROTOCOL_ORACLE

public static final java.lang.String SUBPROTOCOL_ORACLE
The subprotocol used by the standard Oracle driver

See Also:
Constant Field Values

SUBPROTOCOL_ORACLE_INET

public static final java.lang.String SUBPROTOCOL_ORACLE_INET
The subprotocol used by the i-net Oracle driver

See Also:
Constant Field Values

SUBPROTOCOL_POSTGRESQL

public static final java.lang.String SUBPROTOCOL_POSTGRESQL
The subprotocol used by the standard PostgreSQL driver

See Also:
Constant Field Values

SUBPROTOCOL_SAPDB

public static final java.lang.String SUBPROTOCOL_SAPDB
The subprotocol used by the standard Sapdb driver

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE

public static final java.lang.String SUBPROTOCOL_SYBASE
The subprotocol used by the standard Sybase driver

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE_INET

public static final java.lang.String SUBPROTOCOL_SYBASE_INET
The subprotocol used by the i-net Sybase driver

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE_INET_POOLED

public static final java.lang.String SUBPROTOCOL_SYBASE_INET_POOLED
The subprotocol used by the pooled i-net Sybase driver

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE_JTDS

public static final java.lang.String SUBPROTOCOL_SYBASE_JTDS
The subprotocol used by the jTDS Sybase driver

See Also:
Constant Field Values
Constructor Detail

JdbcMetadataUtils

public JdbcMetadataUtils()
Creates a new JdbcMetadataUtils object.

Method Detail

fillJCDFromDataSource

public void fillJCDFromDataSource(JdbcConnectionDescriptor jcd,
                                  javax.sql.DataSource dataSource,
                                  java.lang.String username,
                                  java.lang.String password)
                           throws MetadataException
Fills parameters of the given JdbcConnectionDescriptor with metadata extracted from the given datasource.

Parameters:
jcd - The jdbc connection descriptor to fill
dataSource - The data source
username - The username required to establish a connection via the data source Can be empty if the data source does not require it or if one is specified in the jdbc connection descriptor
password - The username required to establish a connection via the data source Can be empty if the data source or username does not require it or if one is specified in the jdbc connection descriptor
Throws:
MetadataException

parseConnectionUrl

public java.util.HashMap parseConnectionUrl(java.lang.String jdbcConnectionUrl)
Splits the given jdbc connection url into its components and puts them into a hash map using the PROPERTY_ constants.

Parameters:
jdbcConnectionUrl - The connection url
Returns:
The properties

findPlatformFor

public java.lang.String findPlatformFor(java.lang.String jdbcSubProtocol,
                                        java.lang.String jdbcDriver)
Derives the OJB platform to use for a database that is connected via a url using the specified subprotocol, and where the specified jdbc driver is used.

Parameters:
jdbcSubProtocol - The JDBC subprotocol used to connect to the database
jdbcDriver - The JDBC driver used to connect to the database
Returns:
The platform identifier or null if no platform could be found


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30