Related Interfaces

Related interfaces provide JDBC clients with an alternative to the standard approach for obtaining database connections.

  • javax.sql.DataSource

  • javax.naming.Referenceable

  • javax.naming.spi.ObjectFactory

Instead of invoking Class.forName (“com.sybase.jdbc4.jdbc.SybDriver”), then passing a JDBC URL to the DriverManager's getConnection( ) method, clients can access a JNDI name server using a logical name to retrieve a javax.sql.DataSource object. This object is responsible for loading the driver and establishing the connection to the physical database it represents. The client code is simpler and reusable because the vendor-specific information has been placed within the DataSource object.

The Sybase implementation of the DataSource object is com.sybase.jdbcx.SybDataSource (see the Javadoc for details). This implementation supports the standard properties using the design pattern for JavaBean components:

  • databaseName

  • dataSourceName

  • description

  • networkProtocol

  • password

  • portNumber

  • serverName

  • user

Note: roleName is not supported.

jConnect provides an implementation of the javax.naming.spi.ObjectFactory interface so the DataSource object can be constructed from the attributes of a name server entry. When given a javax.naming.Reference, or a javax.naming.Name and a javax.naming.DirContext, this factory can construct com.sybase.jdbcx.SybDataSource objects. To use this factory, set the java.naming.object.factory system property to include com.sybase.jdbc4.SybObjectFactory.