se.unlogic.standardutils.db
Class DBUtils

java.lang.Object
  extended by se.unlogic.standardutils.db.DBUtils

public class DBUtils
extends Object


Constructor Summary
DBUtils()
           
 
Method Summary
static void closeConnection(Connection connection)
           
static void closePreparedStatement(PreparedStatement pstmt)
           
static void closeResultSet(ResultSet rs)
           
static boolean containsColumn(ResultSet rs, String columnName)
           
static DataSource getDataSource(String name)
           
static int getTableColumnCount(DataSource dataSource, String selectedTable)
           
static List<String> getTableColumns(Connection connection, String selectedTable)
           
static ArrayList<String> listAllTables(Connection connection)
           
static boolean tableExists(DataSource dataSource, String tableName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBUtils

public DBUtils()
Method Detail

tableExists

public static boolean tableExists(DataSource dataSource,
                                  String tableName)
                           throws SQLException
Throws:
SQLException

listAllTables

public static ArrayList<String> listAllTables(Connection connection)
                                       throws SQLException
Throws:
SQLException

getDataSource

public static DataSource getDataSource(String name)
                                throws NamingException
Throws:
NamingException

containsColumn

public static boolean containsColumn(ResultSet rs,
                                     String columnName)

getTableColumns

public static List<String> getTableColumns(Connection connection,
                                           String selectedTable)
                                    throws SQLException
Throws:
SQLException

getTableColumnCount

public static int getTableColumnCount(DataSource dataSource,
                                      String selectedTable)
                               throws SQLException
Throws:
SQLException

closeConnection

public static void closeConnection(Connection connection)

closeResultSet

public static void closeResultSet(ResultSet rs)

closePreparedStatement

public static void closePreparedStatement(PreparedStatement pstmt)


Copyright © 2011. All Rights Reserved.