# com.bea.p13n.property
SqlBundle Class

public class SqlBundle
extends `Object`

Utility class to externalize SQL statements in a ResourceBundle.

Hierarchy
  `Object`
  `SqlBundle`

## Field Summary

`public static final `String`` | `SQL_BUNDLE` the property to read to find the name of our sql bundle

## Constructor Summary

SqlBundle() Default constructor
SqlBundle(`String` defaultBundleName) Construct a SqlBundle with a default bundle name

## Method Summary

`public `PreparedStatement`` | `getStatement`(`Connection` conn, `String` key) Use the provided connection to prepare the SQL statement named by the provided key.
`public void` | `init`() Initialize the ResourceBundle that backs up this bundle.
`public void` | `init`(`String` defaultSqlBundle) Initialize the ResourceBundle that backs up this bundle.

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

## Field Detail

### SQL_BUNDLE

    public static final String SQL_BUNDLE

  the property to read to find the name of our sql bundle

## Constructor Detail

### SqlBundle

    public SqlBundle()

  Default constructor

### SqlBundle

    public SqlBundle(String defaultBundleName)

  Construct a SqlBundle with a default bundle name

## Method Detail

### getStatement(Connection, String) Method

    public PreparedStatement getStatement(Connection conn,
                                          String key)
         throws SQLException

Use the provided connection to prepare the SQL statement named by the provided key.

#### Parameters

conn
  a valid database connection

key
  the key to lookup a SQL statement with

#### Returns

a PreparedStatement created with the sql

#### Exceptions

``SQLException``
  if an error occurs creating the statement

### init() Method

    public void init()

Initialize the ResourceBundle that backs up this bundle. This will look for the variable "SqlBundle" in the initial context to find the name to use for the ResourceBundle; if that is not found it will fall back to the name provided in the constructor.

### init(String) Method

    public void init(String defaultSqlBundle)

Initialize the ResourceBundle that backs up this bundle. This will look for the variable "SqlBundle" in the initial context to find the name to use for the ResourceBundle; if that is not found it will fall back to the provided name.

#### Parameters

defaultSqlBundle
  the default name to use for the ResourceBundle