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

## org.apache.ddlutils.util
Class JdbcSupport

    java.lang.Object
      org.apache.ddlutils.util.JdbcSupport

Direct Known Subclasses:
  PlatformImplBase

    public abstract class JdbcSupport

extends Object

JdbcSupport is an abstract base class for objects which need to perform JDBC operations. It contains a number of useful methods for implementation inheritence..

Version:
  $Revision: 463757 $

Constructor Summary
`JdbcSupport()`

Method Summary
`Connection` | `borrowConnection()` Returns a (new) JDBC connection from the data source.
`void` | `closeStatement(Statement statement)` Closes the given statement (which also closes all result sets for this statement) and the connection it belongs to.
`DataSource` | `getDataSource()` Returns the data source used for communicating with the database.
`String` | `getPassword()` Returns the password used to access the database.
`String` | `getUsername()` Returns the username used to access the database.
`void` | `returnConnection(Connection connection)` Closes the given JDBC connection (returns it back to the pool if the datasource is poolable).
`void` | `setDataSource(DataSource dataSource)` Sets the DataSource used for communicating with the database.
`void` | `setPassword(String password)` Sets the password to be used to access the database.
`void` | `setUsername(String username)` Sets the username to be used to access the database.

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

Constructor Detail

### JdbcSupport

    public JdbcSupport()

Method Detail

### getDataSource

    public DataSource getDataSource()

  Returns the data source used for communicating with the database.

  Returns:
    The data source

### setDataSource

    public void setDataSource(DataSource dataSource)

  Sets the DataSource used for communicating with the database.

  Parameters:
    `dataSource` - The data source

### getUsername

    public String getUsername()

  Returns the username used to access the database.

  Returns:
    The username

### setUsername

    public void setUsername(String username)

  Sets the username to be used to access the database.

  Parameters:
    `username` - The username

### getPassword

    public String getPassword()

  Returns the password used to access the database.

  Returns:
    The password

### setPassword

    public void setPassword(String password)

  Sets the password to be used to access the database.

  Parameters:
    `password` - The password

### borrowConnection

    public Connection borrowConnection()
                                throws DatabaseOperationException

  Returns a (new) JDBC connection from the data source.

  Returns:
    The connection
  Throws:
    `DatabaseOperationException`

### returnConnection

    public void returnConnection(Connection connection)

  Closes the given JDBC connection (returns it back to the pool if the datasource is poolable).

  Parameters:
    `connection` - The connection

### closeStatement

    public void closeStatement(Statement statement)

  Closes the given statement (which also closes all result sets for this statement) and the connection it belongs to.

  Parameters:
    `statement` - The statement

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

Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.