org.ujac.util.db
Class DatabaseSchemaReader

java.lang.Object
  extended by org.ujac.util.db.DatabaseSchemaReader

public class DatabaseSchemaReader
extends Object

Name: DatabaseSchemaReader
Description: Reads informations from database schema using DatabaseMetaData.

Author:
lauerc

Constructor Summary
DatabaseSchemaReader(Connection cxn)
          Constructs a DatabaseSchemaReader with specific attributes.
DatabaseSchemaReader(Connection cxn, DataTypeMapper dataTypeMapper)
          Constructs a DatabaseSchemaReader with specific attributes.
DatabaseSchemaReader(String driver, String url, String user, String passwd)
          Constructs a DatabaseSchemaReader with specific attributes.
DatabaseSchemaReader(String driver, String url, String user, String passwd, DataTypeMapper dataTypeMapper)
          Constructs a DatabaseSchemaReader with specific attributes.
 
Method Summary
static String getJavaName(String columnName)
          Gets the java attribute name for the given column name.
 TableDefinition getTableDefinition(String tableName)
          Gets the definition for the given table name.
static void main(String[] args)
          The main method for testing purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseSchemaReader

public DatabaseSchemaReader(Connection cxn)
Constructs a DatabaseSchemaReader with specific attributes.

Parameters:
cxn - The database connection to use.

DatabaseSchemaReader

public DatabaseSchemaReader(Connection cxn,
                            DataTypeMapper dataTypeMapper)
Constructs a DatabaseSchemaReader with specific attributes.

Parameters:
cxn - The database connection to use.
dataTypeMapper - The data type mapper to use.

DatabaseSchemaReader

public DatabaseSchemaReader(String driver,
                            String url,
                            String user,
                            String passwd)
Constructs a DatabaseSchemaReader with specific attributes.

Parameters:
driver - The driver class name.
url - The JDBC URL.
user - The database user.
passwd - The user's password.

DatabaseSchemaReader

public DatabaseSchemaReader(String driver,
                            String url,
                            String user,
                            String passwd,
                            DataTypeMapper dataTypeMapper)
Constructs a DatabaseSchemaReader with specific attributes.

Parameters:
driver - The driver class name.
url - The JDBC URL.
user - The database user.
passwd - The user's password.
dataTypeMapper - The data type mapper to use.
Method Detail

getTableDefinition

public TableDefinition getTableDefinition(String tableName)
                                   throws SQLException
Gets the definition for the given table name.

Parameters:
tableName - The name of the desired table.
Returns:
The definition of the desired table.
Throws:
SQLException - In case a JDBC problem occurred.

getJavaName

public static final String getJavaName(String columnName)
Gets the java attribute name for the given column name.

Parameters:
columnName - The column name.
Returns:
The java attribute name.

main

public static void main(String[] args)
The main method for testing purposes.

Parameters:
args - The command line arguments.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.