com.googlecode.flyway.core.util.jdbc
Class JdbcUtils

java.lang.Object
  extended by com.googlecode.flyway.core.util.jdbc.JdbcUtils

public class JdbcUtils
extends java.lang.Object

Utility class for dealing with jdbc connections.


Method Summary
static void closeConnection(java.sql.Connection connection)
          Safely closes this connection.
static void closeResultSet(java.sql.ResultSet resultSet)
          Safely closes this resultSet.
static void closeStatement(java.sql.Statement statement)
          Safely closes this statement.
static java.sql.Connection openConnection(javax.sql.DataSource dataSource)
          Opens a new connection from this dataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

openConnection

public static java.sql.Connection openConnection(javax.sql.DataSource dataSource)
                                          throws FlywayException
Opens a new connection from this dataSource.

Parameters:
dataSource - The dataSource to obtain the connection from.
Returns:
The new connection.
Throws:
FlywayException - when the connection could not be opened.

closeConnection

public static void closeConnection(java.sql.Connection connection)
Safely closes this connection. This method never fails.

Parameters:
connection - The connection to close.

closeStatement

public static void closeStatement(java.sql.Statement statement)
Safely closes this statement. This method never fails.

Parameters:
statement - The statement to close.

closeResultSet

public static void closeResultSet(java.sql.ResultSet resultSet)
Safely closes this resultSet. This method never fails.

Parameters:
resultSet - The resultSet to close.


Copyright © 2012. All Rights Reserved.