Provides a source of JDBC connections. It has been introduced
because some key generation
algorithms require the creation of separate connections to create the
actual key value. So just passing a single jdbc connection object into
SConnection.attach is not sufficient.
If no connection pooling is used then just do:-
Class.forName(dbDriver);
SDataSource ds = new SDataSource(dburl, dbUserName, dbPassword);
// ds.setSDriverName("..."); to use a non-default driver
SConnection.attach(ds, "TestCon");
attach calls openDBConnection which simply calls
java.sql.DriverManager.getConnection(url, jdbcProperties)
It is intended that this class can be subclassed, especially to enable
connection pooling. It does not directly implement javax.sql.DataSource
to avoid dependencies on Java 1.4 and EJBs.
See Also: SDataSourceJavaX See Also: is normally used for connection pooling. |