Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.util
Class JDBCUtil

    java.lang.Object
      org.ensembl.util.JDBCUtil

public class JDBCUtil
extends java.lang.Object

Utility functions for working with JDBC.

Constructor Summary
`JDBCUtil()`

Method Summary
`static java.lang.String` | `beautifySQL(java.lang.String rawSQL)` Formats sql for reading.
`static void` | `close(java.sql.Connection conn)` Convenience method for closing a connection and logging rather than throwing any exceptions thrown.
`static void` | `close(java.sql.ResultSet rs)` Convenience method for closing a result set and logging rather than throwing any exceptions thrown.
`static void` | `close(java.sql.Statement s)` Convenience method for closing a JDBC statement and logging rather than throwing any exceptions thrown.
`static java.lang.String[]` | `databaseNames(javax.sql.DataSource ds)` Returns list of databases (catalogs) in the datasource.
`static void` | `main(java.lang.String[] args)`
`static java.lang.String` | `toString(java.sql.ResultSet rs)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JDBCUtil

    public JDBCUtil()

Method Detail

### toString

    public static java.lang.String toString(java.sql.ResultSet rs)

  Returns:
    String containing each column in current row of result set.

### beautifySQL

    public static java.lang.String beautifySQL(java.lang.String rawSQL)

  Formats sql for reading.

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### close

    public static void close(java.sql.Connection conn)

  Convenience method for closing a connection and logging rather than throwing any exceptions thrown. Sets conn.setAutoCommit(true) before closing, this is useful if conn is returned to a connection pool. Prints logger.warninging if exception occurs.

### close

    public static void close(java.sql.ResultSet rs)

  Convenience method for closing a result set and logging rather than throwing any exceptions thrown. It can not setAutoCommit(true) before closing. Prints logger.warninging if exception occurs.

### close

    public static void close(java.sql.Statement s)

  Convenience method for closing a JDBC statement and logging rather than throwing any exceptions thrown. Prints logger.warninging if exception occurs.

### databaseNames

    public static java.lang.String[] databaseNames(javax.sql.DataSource ds)
                                            throws java.sql.SQLException

  Returns list of databases (catalogs) in the datasource.

  Parameters:
    `ds` - datasource to query.
  Returns:
    list of databases (catalogs) in the datasource.
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD