org.datanucleus.store.rdbms
Class JDBCUtils

java.lang.Object
  extended by org.datanucleus.store.rdbms.JDBCUtils

public class JDBCUtils
extends java.lang.Object

Convenience helper for JDBC.


Constructor Summary
JDBCUtils()
           
 
Method Summary
static int getJDBCTypeForName(java.lang.String typeName)
          Method to return the type given the "jdbc-type" name.
static int[] getJDBCTypes()
          Accessor for the JDBC types.
static java.lang.String getNameForJDBCType(int jdbcType)
          Accessor for a string name of a JDBC Type
static java.lang.String getSubprotocolForURL(java.lang.String url)
          Method to return the "subprotocol" for a JDBC URL.
static boolean isValidJDBCType(java.lang.String typeName)
          Method to return whether the passed "jdbc-type" is a valid JDBC type for use.
static void logWarnings(java.sql.Connection conn)
          Utility to log all warning for the specified Connection.
static void logWarnings(java.sql.ResultSet rs)
          Utility to log all warning for the specified ResultSet.
static void logWarnings(java.sql.SQLWarning warning)
          Logs SQL warnings to the common log.
static void logWarnings(java.sql.Statement stmt)
          Utility to log all warning for the specified Statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCUtils

public JDBCUtils()
Method Detail

isValidJDBCType

public static boolean isValidJDBCType(java.lang.String typeName)
Method to return whether the passed "jdbc-type" is a valid JDBC type for use.

Parameters:
typeName - "jdbc-type" name
Returns:
Whether it is valid

getJDBCTypes

public static final int[] getJDBCTypes()
Accessor for the JDBC types.

Returns:
JDBC types.

getNameForJDBCType

public static java.lang.String getNameForJDBCType(int jdbcType)
Accessor for a string name of a JDBC Type

Parameters:
jdbcType - The JDBC Type
Returns:
The name

getJDBCTypeForName

public static int getJDBCTypeForName(java.lang.String typeName)
Method to return the type given the "jdbc-type" name.

Parameters:
typeName - "jdbc-type" name
Returns:
Whether it is valid

getSubprotocolForURL

public static java.lang.String getSubprotocolForURL(java.lang.String url)
Method to return the "subprotocol" for a JDBC URL. A JDBC URL is made up of "jdbc:{subprotocol}:...". For example, "jdbc:mysql:..." or "jdbc:hsqldb:...".

Parameters:
url - The JDBC URL
Returns:
The subprotocol

logWarnings

public static void logWarnings(java.sql.SQLWarning warning)
Logs SQL warnings to the common log. Should be called after any operation on a JDBC Statement or ResultSet object.

Parameters:
warning - the value returned from getWarnings().

logWarnings

public static void logWarnings(java.sql.Connection conn)
Utility to log all warning for the specified Connection.

Parameters:
conn - The connection to the datastore

logWarnings

public static void logWarnings(java.sql.Statement stmt)
Utility to log all warning for the specified Statement.

Parameters:
stmt - The statement

logWarnings

public static void logWarnings(java.sql.ResultSet rs)
Utility to log all warning for the specified ResultSet.

Parameters:
rs - The ResultSet


Copyright © 2009. All Rights Reserved.