org.apache.ojb.broker.metadata
Class JdbcMetadataUtils

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

public class JdbcMetadataUtils
extends Object

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

Author:
Thomas Dudziak

Field Summary
static String DRIVER_DB2
          The standard DB2 jdbc driver
static String DRIVER_DB2_INET
          The i-net DB2 jdbc driver
static String DRIVER_FIREBIRD
          The standard Firebird jdbc driver
static String DRIVER_HSQLDB
          The standard Hsqldb jdbc driver
static String DRIVER_INET_POOLED
          The i-net pooled jdbc driver for SQLServer and Sybase
static String DRIVER_INFORMIX
          The standard Informix jdbc driver
static String DRIVER_JTDS
          The jTDS jdbc driver for SQLServer and Sybase
static String DRIVER_MAXDB
          The standard MaxDB jdbc driver
static String DRIVER_MCKOI
          The standard McKoi jdbc driver
static String DRIVER_MSSQLSERVER
          The standard SQLServer jdbc driver
static String DRIVER_MSSQLSERVER_INET
          The i-net SQLServer jdbc driver
static String DRIVER_MSSQLSERVER_JSQLCONNECT
          The JNetDirect SQLServer jdbc driver
static String DRIVER_MYSQL
          The standard MySQL jdbc driver
static String DRIVER_MYSQL_OLD
          The old MySQL jdbc driver
static String DRIVER_ORACLE
          The standard Oracle jdbc driver
static String DRIVER_ORACLE_INET
          The i-net Oracle jdbc driver
static String DRIVER_POSTGRESQL
          The standard PostgreSQL jdbc driver
static String DRIVER_SAPDB
          The standard Sapdb jdbc driver
static String DRIVER_SYBASE
          The standard Sybase jdbc driver
static String DRIVER_SYBASE_INET
          The i-net Sybase jdbc driver
static String DRIVER_SYBASE_OLD
          The old Sybase jdbc driver
private  HashMap jdbcDriverToPlatform
          Maps the jdbc driver name to a OJB platform name
private  HashMap jdbcSubProtocolToPlatform
          Maps the sub-protocl part of a jdbc connection url to a OJB platform name
static String PLATFORM_DB2
          Identifier for the DB2 platform
static String PLATFORM_FIREBIRD
          Identifier for the Firebird platform
static String PLATFORM_HSQLDB
          Identifier for the Hsqldb platform
static String PLATFORM_INFORMIX
          Identifier for the Informix platform
static String PLATFORM_MAXDB
          Identifier for the MaxDB platform
static String PLATFORM_MCKOI
          Identifier for the McKoi platform
static String PLATFORM_MSACCESS
          Identifier for the MsAccess platform
static String PLATFORM_MSSQLSERVER
          Identifier for the Microsoft SQL Server platform
static String PLATFORM_MYSQL
          Identifier for the MySQL platform
static String PLATFORM_ORACLE
          Identifier for the generic Oracle platform
static String PLATFORM_ORACLE9I
          Identifier for the Oracle9i platform
static String PLATFORM_POSTGRESQL
          Identifier for the PostgresSQL platform
static String PLATFORM_SYBASE
          Identifier for the generic Sybase platform
static String PLATFORM_SYBASEASA
          Identifier for the Sybase ASA platform
static String PLATFORM_SYBASEASE
          Identifier for the Sybase ASE platform
static String PLATFORM_WLORACLE9I
          Identifier for the Oracle9i for WebLogic platform
static String PROPERTY_DBALIAS
          The name of the property returned by the #splitConnectionUrl(String) method that contains the database alias (the actual database url)
static String PROPERTY_PROTOCOL
          The name of the property returned by the #splitConnectionUrl(String) method that contains the protocol
static String PROPERTY_SUBPROTOCOL
          The name of the property returned by the #splitConnectionUrl(String) method that contains the sub protocol
static String SUBPROTOCOL_DB2
          The subprotocol used by the standard DB2 driver
static String SUBPROTOCOL_DB2_INET
          The subprotocol used by the i-net DB2 driver
static String SUBPROTOCOL_FIREBIRD
          The subprotocol used by the standard Firebird driver
static String SUBPROTOCOL_HSQLDB
          The subprotocol used by the standard Hsqldb driver
static String SUBPROTOCOL_INFORMIX
          The subprotocol used by the standard Informix driver
static String SUBPROTOCOL_MAXDB
          The subprotocol used by the standard MaxDB driver
static String SUBPROTOCOL_MCKOI
          The subprotocol used by the standard McKoi driver
static String SUBPROTOCOL_MSSQLSERVER
          The subprotocol used by the standard SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER_INET
          A subprotocol used by the i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER_JSQLCONNECT
          The subprotocol used by the JNetDirect SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER_JTDS
          The subprotocol used by the jTDS SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER6_INET
          A subprotocol used by the i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER6_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER7_INET
          A subprotocol used by the i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER7_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER7A_INET
          A subprotocol used by the i-net SQLServer driver
static String SUBPROTOCOL_MSSQLSERVER7A_INET_POOLED
          A subprotocol used by the pooled i-net SQLServer driver
static String SUBPROTOCOL_MYSQL
          The subprotocol used by the standard MySQL driver
static String SUBPROTOCOL_ORACLE
          The subprotocol used by the standard Oracle driver
static String SUBPROTOCOL_ORACLE_INET
          The subprotocol used by the i-net Oracle driver
static String SUBPROTOCOL_POSTGRESQL
          The subprotocol used by the standard PostgreSQL driver
static String SUBPROTOCOL_SAPDB
          The subprotocol used by the standard Sapdb driver
static String SUBPROTOCOL_SYBASE
          The subprotocol used by the standard Sybase driver
static String SUBPROTOCOL_SYBASE_INET
          The subprotocol used by the i-net Sybase driver
static String SUBPROTOCOL_SYBASE_INET_POOLED
          The subprotocol used by the pooled i-net Sybase driver
static 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, DataSource dataSource, String username, String password)
          Fills parameters of the given JdbcConnectionDescriptor with metadata extracted from the given datasource.
 String findPlatformFor(String jdbcSubProtocol, 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.
 HashMap parseConnectionUrl(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PROTOCOL

public static final 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 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 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 String PLATFORM_DB2
Identifier for the DB2 platform

See Also:
Constant Field Values

PLATFORM_FIREBIRD

public static final String PLATFORM_FIREBIRD
Identifier for the Firebird platform

See Also:
Constant Field Values

PLATFORM_HSQLDB

public static final String PLATFORM_HSQLDB
Identifier for the Hsqldb platform

See Also:
Constant Field Values

PLATFORM_INFORMIX

public static final String PLATFORM_INFORMIX
Identifier for the Informix platform

See Also:
Constant Field Values

PLATFORM_MAXDB

public static final String PLATFORM_MAXDB
Identifier for the MaxDB platform

See Also:
Constant Field Values

PLATFORM_MCKOI

public static final String PLATFORM_MCKOI
Identifier for the McKoi platform

See Also:
Constant Field Values

PLATFORM_MSACCESS

public static final String PLATFORM_MSACCESS
Identifier for the MsAccess platform

See Also:
Constant Field Values

PLATFORM_MSSQLSERVER

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

See Also:
Constant Field Values

PLATFORM_MYSQL

public static final String PLATFORM_MYSQL
Identifier for the MySQL platform

See Also:
Constant Field Values

PLATFORM_ORACLE

public static final String PLATFORM_ORACLE
Identifier for the generic Oracle platform

See Also:
Constant Field Values

PLATFORM_ORACLE9I

public static final String PLATFORM_ORACLE9I
Identifier for the Oracle9i platform

See Also:
Constant Field Values

PLATFORM_POSTGRESQL

public static final String PLATFORM_POSTGRESQL
Identifier for the PostgresSQL platform

See Also:
Constant Field Values

PLATFORM_SYBASE

public static final String PLATFORM_SYBASE
Identifier for the generic Sybase platform

See Also:
Constant Field Values

PLATFORM_SYBASEASA

public static final String PLATFORM_SYBASEASA
Identifier for the Sybase ASA platform

See Also:
Constant Field Values

PLATFORM_SYBASEASE

public static final String PLATFORM_SYBASEASE
Identifier for the Sybase ASE platform

See Also:
Constant Field Values

PLATFORM_WLORACLE9I

public static final String PLATFORM_WLORACLE9I
Identifier for the Oracle9i for WebLogic platform

See Also:
Constant Field Values

DRIVER_DB2

public static final String DRIVER_DB2
The standard DB2 jdbc driver

See Also:
Constant Field Values

DRIVER_DB2_INET

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

See Also:
Constant Field Values

DRIVER_FIREBIRD

public static final String DRIVER_FIREBIRD
The standard Firebird jdbc driver

See Also:
Constant Field Values

DRIVER_HSQLDB

public static final String DRIVER_HSQLDB
The standard Hsqldb jdbc driver

See Also:
Constant Field Values

DRIVER_INET_POOLED

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

See Also:
Constant Field Values

DRIVER_INFORMIX

public static final String DRIVER_INFORMIX
The standard Informix jdbc driver

See Also:
Constant Field Values

DRIVER_JTDS

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

See Also:
Constant Field Values

DRIVER_MAXDB

public static final String DRIVER_MAXDB
The standard MaxDB jdbc driver

See Also:
Constant Field Values

DRIVER_MCKOI

public static final String DRIVER_MCKOI
The standard McKoi jdbc driver

See Also:
Constant Field Values

DRIVER_MSSQLSERVER

public static final String DRIVER_MSSQLSERVER
The standard SQLServer jdbc driver

See Also:
Constant Field Values

DRIVER_MSSQLSERVER_INET

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

See Also:
Constant Field Values

DRIVER_MSSQLSERVER_JSQLCONNECT

public static final String DRIVER_MSSQLSERVER_JSQLCONNECT
The JNetDirect SQLServer jdbc driver

See Also:
Constant Field Values

DRIVER_MYSQL

public static final String DRIVER_MYSQL
The standard MySQL jdbc driver

See Also:
Constant Field Values

DRIVER_MYSQL_OLD

public static final String DRIVER_MYSQL_OLD
The old MySQL jdbc driver

See Also:
Constant Field Values

DRIVER_ORACLE

public static final String DRIVER_ORACLE
The standard Oracle jdbc driver

See Also:
Constant Field Values

DRIVER_ORACLE_INET

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

See Also:
Constant Field Values

DRIVER_POSTGRESQL

public static final String DRIVER_POSTGRESQL
The standard PostgreSQL jdbc driver

See Also:
Constant Field Values

DRIVER_SAPDB

public static final String DRIVER_SAPDB
The standard Sapdb jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE

public static final String DRIVER_SYBASE
The standard Sybase jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE_OLD

public static final String DRIVER_SYBASE_OLD
The old Sybase jdbc driver

See Also:
Constant Field Values

DRIVER_SYBASE_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_DB2

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

See Also:
Constant Field Values

SUBPROTOCOL_DB2_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_FIREBIRD

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

See Also:
Constant Field Values

SUBPROTOCOL_HSQLDB

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

See Also:
Constant Field Values

SUBPROTOCOL_INFORMIX

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

See Also:
Constant Field Values

SUBPROTOCOL_MAXDB

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

See Also:
Constant Field Values

SUBPROTOCOL_MCKOI

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

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER

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

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER6_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER7A_INET

public static final 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 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 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 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 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 String SUBPROTOCOL_MSSQLSERVER_JSQLCONNECT
The subprotocol used by the JNetDirect SQLServer driver

See Also:
Constant Field Values

SUBPROTOCOL_MSSQLSERVER_JTDS

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

See Also:
Constant Field Values

SUBPROTOCOL_MYSQL

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

See Also:
Constant Field Values

SUBPROTOCOL_ORACLE

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

See Also:
Constant Field Values

SUBPROTOCOL_ORACLE_INET

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

See Also:
Constant Field Values

SUBPROTOCOL_POSTGRESQL

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

See Also:
Constant Field Values

SUBPROTOCOL_SAPDB

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

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE

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

See Also:
Constant Field Values

SUBPROTOCOL_SYBASE_INET

public static final 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 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 String SUBPROTOCOL_SYBASE_JTDS
The subprotocol used by the jTDS Sybase driver

See Also:
Constant Field Values

jdbcSubProtocolToPlatform

private HashMap jdbcSubProtocolToPlatform
Maps the sub-protocl part of a jdbc connection url to a OJB platform name


jdbcDriverToPlatform

private HashMap jdbcDriverToPlatform
Maps the jdbc driver name to a OJB platform name

Constructor Detail

JdbcMetadataUtils

public JdbcMetadataUtils()
Creates a new JdbcMetadataUtils object.

Method Detail

fillJCDFromDataSource

public void fillJCDFromDataSource(JdbcConnectionDescriptor jcd,
                                  DataSource dataSource,
                                  String username,
                                  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 HashMap parseConnectionUrl(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 String findPlatformFor(String jdbcSubProtocol,
                              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


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.