A data source for H2 database connections. It is a factory for XAConnection
and Connection objects. This class is usually registered in a JNDI naming
service. To create a data source object and register it with a JNDI service,
use the following code:
In this example the user name and password are serialized as
well; this may be a security problem in some cases.
Methods |
|
JdbcDataSource()
The public constructor.
|
|
JdbcDataSource()
The public constructor.
|
Connection |
getConnection()
Open a new connection using the current URL, user name and password.
|
Connection |
getConnection() throws SQLException
Open a new connection using the current URL, user name and password.
Returns:
the connection
|
Connection |
getConnection(String user, String password)
Open a new connection using the current URL and the specified user name
and password.
|
Connection |
getConnection(String user, String password) throws SQLException
Open a new connection using the current URL and the specified user name
and password.
Parameters:
user - the user name
password - the password
Returns:
the connection
|
String |
getDescription()
Get the current description.
|
String |
getDescription()
Get the current description.
Returns:
the description
|
PrintWriter |
getLogWriter()
Get the current log writer for this object.
|
PrintWriter |
getLogWriter()
Get the current log writer for this object.
Returns:
the log writer
|
int |
getLoginTimeout()
Get the login timeout in seconds, 0 meaning no timeout.
|
int |
getLoginTimeout()
Get the login timeout in seconds, 0 meaning no timeout.
Returns:
the timeout in seconds
|
Logger |
getParentLogger()
[Not supported]
|
Logger |
getParentLogger()
[Not supported]
|
String |
getPassword()
Get the current password.
|
String |
getPassword()
Get the current password.
Returns:
the password
|
PooledConnection |
getPooledConnection()
Open a new pooled connection using the current URL, user name and
password.
|
PooledConnection |
getPooledConnection() throws SQLException
Open a new pooled connection using the current URL, user name and
password.
Returns:
the connection
|
PooledConnection |
getPooledConnection(String user, String password)
Open a new pooled connection using the current URL and the specified user
name and password.
|
PooledConnection |
getPooledConnection(String user, String password) throws SQLException
Open a new pooled connection using the current URL and the specified user
name and password.
Parameters:
user - the user name
password - the password
Returns:
the connection
|
Reference |
getReference()
Get a new reference for this object, using the current settings.
|
Reference |
getReference()
Get a new reference for this object, using the current settings.
Returns:
the new reference
|
String |
getURL()
Get the current URL.
|
String |
getURL()
Get the current URL.
Returns:
the URL
|
String |
getUrl()
Get the current URL.
|
String |
getUrl()
Get the current URL.
This method does the same as getURL, but this methods signature conforms
the JavaBean naming convention.
Returns:
the URL
|
String |
getUser()
Get the current user name.
|
String |
getUser()
Get the current user name.
Returns:
the user name
|
XAConnection |
getXAConnection()
Open a new XA connection using the current URL, user name and password.
|
XAConnection |
getXAConnection() throws SQLException
Open a new XA connection using the current URL, user name and password.
Returns:
the connection
|
XAConnection |
getXAConnection(String user, String password)
Open a new XA connection using the current URL and the specified user
name and password.
|
XAConnection |
getXAConnection(String user, String password) throws SQLException
Open a new XA connection using the current URL and the specified user
name and password.
Parameters:
user - the user name
password - the password
Returns:
the connection
|
boolean |
isWrapperFor(Class iface)
[Not supported] Checks if unwrap can return an object of this class.
|
boolean |
isWrapperFor(Class iface) throws SQLException
[Not supported] Checks if unwrap can return an object of this class.
Parameters:
iface - the class
|
void |
setDescription(String description)
Set the description.
|
void |
setDescription(String description)
Set the description.
Parameters:
description - the new description
|
void |
setLogWriter(PrintWriter out)
Set the current log writer for this object.
|
void |
setLogWriter(PrintWriter out)
Set the current log writer for this object.
This value is ignored by this database.
Parameters:
out - the log writer
|
void |
setLoginTimeout(int timeout)
Set the login timeout in seconds, 0 meaning no timeout.
|
void |
setLoginTimeout(int timeout)
Set the login timeout in seconds, 0 meaning no timeout.
The default value is 0.
This value is ignored by this database.
Parameters:
timeout - the timeout in seconds
|
void |
setPassword(String password)
Set the current password.
|
void |
setPassword(String password)
Set the current password.
Parameters:
password - the new password.
|
void |
setPasswordChars(char[] password)
Set the current password in the form of a char array.
|
void |
setPasswordChars(char[] password)
Set the current password in the form of a char array.
Parameters:
password - the new password in the form of a char array.
|
void |
setURL(String url)
Set the current URL.
|
void |
setURL(String url)
Set the current URL.
Parameters:
url - the new URL
|
void |
setUrl(String url)
Set the current URL.
|
void |
setUrl(String url)
Set the current URL.
This method does the same as setURL, but this methods signature conforms
the JavaBean naming convention.
Parameters:
url - the new URL
|
void |
setUser(String user)
Set the current user name.
|
void |
setUser(String user)
Set the current user name.
Parameters:
user - the new user name
|
T |
unwrap(Class iface)
[Not supported] Return an object of this class if possible.
|
T |
unwrap(Class iface) throws SQLException
[Not supported] Return an object of this class if possible.
Parameters:
iface - the class
|