org.openi.jdbc
Class ConnectionFactory
java.lang.Object
org.openi.jdbc.ConnectionFactory
public class ConnectionFactory
- extends java.lang.Object
Factory class, returns a java.sql.Connection, should also be modified to wrap a
connection pool datasource.
sqlserver
net.sourceforge.jtds.jdbc.Driver
jdbc:jtds:sqlserver://server:1433/db;user=userName;password=password
mysql
com.mysql.jdbc.Driver
jdbc:mysql://your_server:3306/your_database
postgres
org.postgresql.Driver
jdbc:postgresql://host:5432/database?user=userName&password=pass
|
Method Summary |
static void |
cleanupConnection(java.sql.Connection conn)
utility method that cleans up the connection, while trapping
and logging only the messages |
static java.sql.Connection |
getConnection(JdbcDatasource datasource)
|
static java.sql.Connection |
getConnection(java.lang.String driver,
java.lang.String url,
java.util.Properties props)
TODO: modify to retrieve from connection pool |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConnectionFactory
public ConnectionFactory()
getConnection
public static java.sql.Connection getConnection(java.lang.String driver,
java.lang.String url,
java.util.Properties props)
throws java.lang.ClassNotFoundException,
java.sql.SQLException
- TODO: modify to retrieve from connection pool
- Parameters:
driver - url - props -
- Returns:
-
- Throws:
java.lang.ClassNotFoundException
java.sql.SQLException
cleanupConnection
public static void cleanupConnection(java.sql.Connection conn)
- utility method that cleans up the connection, while trapping
and logging only the messages
getConnection
public static java.sql.Connection getConnection(JdbcDatasource datasource)
throws java.lang.ClassNotFoundException,
java.sql.SQLException
- Throws:
java.lang.ClassNotFoundException
java.sql.SQLException