Class JdbcUtils


  • public final class JdbcUtils
    extends java.lang.Object
    JDBC utilities
    Version:
    $Id: JdbcUtils.java,v 1.3 2004/10/23 15:25:44 thlee Exp $ $Name: $
    Author:
    TiongHiang Lee (thlee@onemindsoft.org)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Map CLASS_TO_TYPE_MAP
      map the java classes to jdbc type int *
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JdbcUtils()
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static MetaData getMetaData​(java.sql.ResultSetMetaData meta, java.lang.String name)
      return the MetaData
      static MetaData getMetaData​(java.sql.ResultSet rst, java.lang.String name)
      Get the MetaData from the resultset
      static boolean isJdbcType​(java.lang.Class c)
      Return whether a java type is a jdbc type
      static int toJdbcType​(java.lang.Class c)
      Return the jdbc type given the java type (based on JDBC spec)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CLASS_TO_TYPE_MAP

        public static final java.util.Map CLASS_TO_TYPE_MAP
        map the java classes to jdbc type int *
    • Constructor Detail

      • JdbcUtils

        private JdbcUtils()
    • Method Detail

      • getMetaData

        public static MetaData getMetaData​(java.sql.ResultSet rst,
                                           java.lang.String name)
                                    throws java.sql.SQLException
        Get the MetaData from the resultset
        Parameters:
        rst - the result set
        name - the name of metadata to create
        Returns:
        the metadata
        Throws:
        java.sql.SQLException - if there's database problem
      • getMetaData

        public static MetaData getMetaData​(java.sql.ResultSetMetaData meta,
                                           java.lang.String name)
                                    throws java.sql.SQLException
        return the MetaData
        Parameters:
        meta - the resultset metadata
        name - the name
        Returns:
        the meta data
        Throws:
        java.sql.SQLException - if there's database problem
      • toJdbcType

        public static int toJdbcType​(java.lang.Class c)
        Return the jdbc type given the java type (based on JDBC spec)
        Parameters:
        c - the java class
        Returns:
        the jdbc type
      • isJdbcType

        public static boolean isJdbcType​(java.lang.Class c)
        Return whether a java type is a jdbc type
        Parameters:
        c - the class
        Returns:
        true if it's jdbc type