|
SafeJDBC v2.00 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.safejdbc.api.CipherConnectionFactory
public final class CipherConnectionFactory
Factory to create a Cipher Connection -
A Cipher Connection is a Connection that enables the automatic encryption and
decryption of SQL statements and results using and wrapping a native database Connection.
Because each Cipher Connection wraps a Connection, this mechanism allows safe
connection pooling with SafeJDBC.
Note that it is much better and easier to manage connection pooling using the
DataSource
mechanism, such as in Tomcat 5.0 implementation.
The SafeDataSourceFactory class is designed for this purpose and
is documented in the SafeJDBC PDF User Documentation.
A Cipher Connection is built using 2 Java/JDBC Connections:
SafeJdbcSetter class or using an ini file:
// This is the application database url
String sDbUrl = "jdbc:mysql://localhost:3306/sj_clients";
// These are the username & password for the application database
Properties propsApp = new Properties();
propsApp.put("user", "safelogic");
propsApp.put("password", "safelogic*$");
// Load the native Driver and get a normal Connection to the application database.
// Note: this could be done using the DataSource mechanism in a J2EE environment.
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
// Get a Connection to the application database
Connection conApplication = DriverManager.getConnection(sDbUrl, propsApp);
// This is the SafeJdbc Catalog database url
String sSafeJdbcDbUrl = "jdbc:mysql://localhost:3306/safejdbc_catalog";
Properties propsSjdbc = new Properties();
propsSjdbc.put("user", "safelogic");
propsSjdbc.put("password", "safelogic*$");
// Get a Connection to the SafeJdbc Catalog database
Connection conSafeJdbcCatalog = DriverManager.getConnection(sSafeJdbcDbUrl, propsSjdbc);
// Get the Cipher Connection for the encryption of statements and results
Connection connection = CipherConnectionFactory.getInstance(conApplication, conSafeJdbcCatalog);
SafeDataSourceFactory| Method Summary | |
|---|---|
static Connection |
getInstance(Connection conApplication)
Deprecated. Please use createCipherConnection(Connection, Connection) |
static Connection |
getInstance(Connection conApplication,
Connection conSafeJdbcCatalog)
Creates a Cipher Connection to eanble the automatic and transparent encryption and decryption of SQL statements and results. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Connection getInstance(Connection conApplication)
throws SQLException
conApplication - the native application database
Connection to be used.
SQLException - if a SQL Exception occurs.
public static Connection getInstance(Connection conApplication,
Connection conSafeJdbcCatalog)
throws SQLException
Driver instance and does not create a
new physical Connection to the database.
conApplication - the native application database Connection to be used.conSafeJdbcCatalog - the SafeJdbc Catalog database Connection to be used.
SQLException - if a SQL Exception occurs.
|
SafeJDBC v2.00 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||