|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.jdbc.EmbeddedSimpleDataSource
EmbeddedSimpleDataSource is Derby's DataSource implementation for J2ME/CDC/Foundation. It is also supports J2SE platforms. Supports the same properties as EmbeddedDataSource, see that class for details.
EmbeddedSimpleDataSource automatically supports the correct JDBC specification version for the Java Virtual Machine's environment.
EmbeddedDataSource
Field Summary | |
private boolean |
attributesAsPassword
Set password to be a set of connection attributes. |
private java.lang.String |
connectionAttributes
Cloudscape specific connection attributes. |
private java.lang.String |
createDatabase
Set to "create" if the database should be created. |
private java.lang.String |
databaseName
The database name. |
private java.lang.String |
dataSourceName
The data source name. |
private java.lang.String |
description
Description of the database. |
protected InternalDriver |
driver
|
private java.lang.String |
jdbcurl
|
private int |
loginTimeout
|
private java.lang.String |
password
|
private java.io.PrintWriter |
printer
instance variables that will not be serialized |
private java.lang.String |
shutdownDatabase
Set to "shutdown" if the database should be shutdown. |
private java.lang.String |
user
|
Constructor Summary | |
EmbeddedSimpleDataSource()
No-arg constructor. |
Method Summary | |
(package private) InternalDriver |
findDriver()
|
boolean |
getAttributesAsPassword()
Return the value of the attributesAsPassword property. |
java.sql.Connection |
getConnection()
Attempt to establish a database connection. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Attempt to establish a database connection with the given username and password. |
(package private) java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password,
boolean requestPassword)
|
java.lang.String |
getConnectionAttributes()
|
java.lang.String |
getCreateDatabase()
|
java.lang.String |
getDatabaseName()
|
java.lang.String |
getDataSourceName()
|
java.lang.String |
getDescription()
|
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. |
java.io.PrintWriter |
getLogWriter()
Get the log writer for this data source. |
java.lang.String |
getPassword()
|
java.lang.String |
getShutdownDatabase()
|
java.lang.String |
getUser()
|
void |
setAttributesAsPassword(boolean attributesAsPassword)
Set attributeAsPassword property to enable passing connection request attributes in the password argument of getConnection. |
void |
setConnectionAttributes(java.lang.String prop)
Set this property to pass in more Cloudscape specific connection URL attributes. |
void |
setCreateDatabase(java.lang.String create)
Set this property to create a new database. |
void |
setDatabaseName(java.lang.String databaseName)
Set the database name. |
void |
setDataSourceName(java.lang.String dsn)
Set the data source name. |
void |
setDescription(java.lang.String desc)
Set the data source descripton. |
void |
setLoginTimeout(int seconds)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. |
void |
setLogWriter(java.io.PrintWriter out)
Set the log writer for this data source. |
void |
setPassword(java.lang.String password)
Set the password property for the data source. |
void |
setShutdownDatabase(java.lang.String shutdown)
Set this property if one wishes to shutdown the database identified by databaseName. |
void |
setUser(java.lang.String user)
Set the user property for the data source. |
(package private) void |
update()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String password
private java.lang.String user
private java.lang.String databaseName
private java.lang.String dataSourceName
private java.lang.String description
private java.lang.String createDatabase
private java.lang.String shutdownDatabase
private java.lang.String connectionAttributes
private boolean attributesAsPassword
private transient java.io.PrintWriter printer
private transient int loginTimeout
protected transient InternalDriver driver
private transient java.lang.String jdbcurl
Constructor Detail |
public EmbeddedSimpleDataSource()
Method Detail |
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
- if a database access error occurs.public void setLoginTimeout(int seconds) throws java.sql.SQLException
Cloudscape ignores this property.
setLoginTimeout
in interface javax.sql.DataSource
seconds
- the data source login time limit
java.sql.SQLException
- if a database access error occurs.public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
- if a database-access error occurs.public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a data source object is created the log writer is initially null, in other words, logging is disabled.
setLogWriter
in interface javax.sql.DataSource
out
- the new log writer; to disable, set to null
java.sql.SQLException
- if a database-access error occurs.public final void setDatabaseName(java.lang.String databaseName)
databaseName
- the name of the databasepublic java.lang.String getDatabaseName()
public final void setDataSourceName(java.lang.String dsn)
dsn
- the name of the data sourcepublic final java.lang.String getDataSourceName()
public final void setDescription(java.lang.String desc)
desc
- the description of the data sourcepublic final java.lang.String getDescription()
public final void setUser(java.lang.String user)
user
property for the data source. This is user
name for any data source getConnection() call that takes no arguments.
public final java.lang.String getUser()
public final void setPassword(java.lang.String password)
password
property for the data source. This is
user's password for any data source getConnection() call that takes no
arguments.
public final java.lang.String getPassword()
public final void setCreateDatabase(java.lang.String create)
create
- if set to the string "create", this data source will try to
create a new database of databaseName, or boot the database if
one by that name already exists.public final java.lang.String getCreateDatabase()
public final void setShutdownDatabase(java.lang.String shutdown)
shutdown
- if set to the string "shutdown", this data source will
shutdown the database if it is running.public final java.lang.String getShutdownDatabase()
public final void setConnectionAttributes(java.lang.String prop)
prop
- set to the list of Cloudscape connection attributes separated
by semi-colons. E.g., to specify an encryption bootPassword of
"x8hhk2adf", and set upgrade to true, do the following:
ds.setConnectionAttributes("bootPassword=x8hhk2adf;upgrade=true");See Cloudscape's documentation for complete list.
public final java.lang.String getConnectionAttributes()
public final void setAttributesAsPassword(boolean attributesAsPassword)
attributesAsPassword
- true to encode password argument as a set of connection
attributes in a connection request.public final boolean getAttributesAsPassword()
public final java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if a database-access error occurs.public final java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
username
- the database user on whose behalf the Connection is being madepassword
- the user's password
java.sql.SQLException
- if a database-access error occurs.final java.sql.Connection getConnection(java.lang.String username, java.lang.String password, boolean requestPassword) throws java.sql.SQLException
requestPassword
- true if the password came from the getConnection() call.
java.sql.SQLException
InternalDriver findDriver() throws java.sql.SQLException
java.sql.SQLException
void update()
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |