Name
DataSource
Synopsis
Interface
Name:
javax.sql.DataSource
Superclass: None
Immediate Subclasses: None
Interfaces Implemented: None
Availability: New as of JDK 1.2
Description
This class provides access to a database via JNDI. To get a JDBC connection, you can look up a data source in a JNDI naming or directory service and then grab a connection from that data source.
Class Summary
public interface DataSource {
java.sql.Connection getConnection( )
throws java.sql.SQLException;
java.sql.Connection getConnection(String uid, String pw)
throws java.sql.SQLException;
int getLoginTimeout( ) throws java.sql.SQLException;
java.io.PrintWriter getLogWriter( )
throws java.sql.SQLException;
void setLoginTimeout(int sec) throws java.sql.SQLException;
void setLogWriter(java.io.PrintWriter pw)
throws java.sql.SQLException;
}Object Methods
getConnection( )
public java.sql.Connection getConnection( ) throws java.sql.SQLException; public java.sql.Connection getConnection(String uid, String pw) throws java.sql.SQLException;
- Description
These are factory methods for the allocation of a connection to a database from a connection pool.
getLoginTimeout( ) and setLoginTimeout( )
public int getLoginTimeout( ) throws java.sql.SQLException; public void setLoginTimeout(int sec) throws java.sql.SQLException;
- Description
These methods get and set a connection for the interval that the system waits to establish before giving up. This value is an interval in seconds. A value of zero directs the data source to depend on ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access