Methods Summary |
---|
public java.sql.Connection | getConnection()Attempt to establish a database connection using defaults.
return getConnection(null, null);
|
public java.sql.Connection | getConnection(java.lang.String userName, java.lang.String passWord)Attempt to establish a database connection using the given
username and password as credentials.
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
System.err.println("Can't load driver; check CLASSPATH!");
return null;
} catch (Exception ex) {
System.err.println("Can't load driver: " + ex);
return null;
}
Properties props = new Properties();
props.setProperty("user", userName);
props.setProperty("password", passWord);
Connection c = DriverManager.getConnection(dbURL, props);
return c;
|
public java.io.PrintWriter | getLogWriter()Get the log writer for this data source.
return logWriter;
|
public int | getLoginTimeout()Gets the maximum time in seconds that this data source can wait
while attempting to connect to the database.
return DriverManager.getLoginTimeout();
|
public void | setLogWriter(java.io.PrintWriter out)Set the log writer for this data source.
logWriter = out;
|
public void | setLoginTimeout(int seconds)Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database.
DriverManager.setLoginTimeout(seconds);
|