|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.firebirdsql.pool.FBSimpleDataSource
public class FBSimpleDataSource
This is a simple implementation of DataSource
interface. Connections
are physically opened in DataSource.getConnection()
method and
physically closed in Connection.close()
method. If you need connection
pooling, use FBWrappingDataSource
instead.
Field Summary | |
---|---|
protected java.lang.String |
description
|
protected FBDataSource |
ds
|
protected javax.naming.Reference |
jndiReference
|
protected java.io.PrintWriter |
log
|
protected int |
loginTimeout
|
protected FBManagedConnectionFactory |
mcf
|
Constructor Summary | |
---|---|
FBSimpleDataSource()
Create instance of this class. |
|
FBSimpleDataSource(org.firebirdsql.gds.impl.GDSType type)
Create instance of this class. |
Method Summary | |
---|---|
java.lang.Integer |
getBlobBufferLength()
Get buffer length for the BLOB fields. |
int |
getBlobBufferSize()
|
int |
getBuffersNumber()
|
java.lang.String |
getCharSet()
|
java.sql.Connection |
getConnection()
Get JDBC connection with default credentials. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Get JDBC connection with the specified credentials. |
java.lang.String |
getDatabase()
Get name of the database. |
java.lang.String |
getDatabaseName()
Deprecated. use getDatabase() instead for the sake of naming
compatibility. |
DatabaseParameterBuffer |
getDatabaseParameterBuffer()
Get the database parameter buffer corresponding to the current connection request information. |
protected javax.sql.DataSource |
getDataSource()
Get underlying connection factory (in our case instance of FBDataSource class) that will provide JDBC connections. |
java.lang.String |
getDefaultIsolation()
Get the default transaction isolation level as string. |
int |
getDefaultTransactionIsolation()
Get the default transaction isolation level. |
java.lang.String |
getDescription()
Get description of this datasource. |
java.lang.String |
getEncoding()
Get encoding for connections produced by this data source. |
int |
getLoginTimeout()
Get login timeout specified for this datasource. |
java.io.PrintWriter |
getLogWriter()
Get log for this datasource. |
java.lang.String |
getNonStandardProperty(java.lang.String key)
Get the property that does not have corresponding getter method by its name. |
java.lang.String |
getPassword()
Get password used in getConnection() method. |
javax.naming.Reference |
getReference()
Get previously set JNDI reference. |
java.lang.String |
getRoleName()
|
int |
getSocketBufferSize()
|
java.lang.String |
getSqlDialect()
|
java.lang.String |
getTpbMapping()
Get the used TPB mapping. |
TransactionParameterBuffer |
getTransactionParameters(int isolation)
Get the transaction parameter buffer corresponding to the current connection request information. |
java.lang.String |
getType()
|
java.lang.String |
getUser()
Deprecated. use getUserName() instead for the sake of naming
compatibility. |
java.lang.String |
getUserName()
Get user name that is used in getConnection() method. |
java.lang.String |
getUseTranslation()
|
boolean |
isDefaultResultSetHoldable()
|
boolean |
isTimestampUsesLocalTimezone()
|
boolean |
isUseStandardUdf()
|
boolean |
isUseStreamBlobs()
|
boolean |
isWrapperFor(java.lang.Class arg0)
|
void |
setBlobBufferLength(java.lang.Integer length)
Set BLOB buffer length. |
void |
setBlobBufferSize(int bufferSize)
|
void |
setBuffersNumber(int buffersNumber)
|
void |
setCharSet(java.lang.String charSet)
|
void |
setDatabase(java.lang.String name)
Set database name. |
void |
setDatabaseName(java.lang.String name)
Deprecated. use setDatabase(String) instead for the sake of
naming compatibility. |
void |
setDefaultIsolation(java.lang.String isolation)
Set the default transaction isolation level as string. |
void |
setDefaultResultSetHoldable(boolean isHoldable)
|
void |
setDefaultTransactionIsolation(int defaultIsolationLevel)
Set the default transaction isolation level. |
void |
setDescription(java.lang.String description)
Set description of this datasource. |
void |
setEncoding(java.lang.String encoding)
Set encoding for connections produced by this data source. |
void |
setLoginTimeout(int loginTimeout)
Set login timeout for this datasource. |
void |
setLogWriter(java.io.PrintWriter log)
Set log for this datasource. |
void |
setNonStandardProperty(java.lang.String propertyMapping)
Set the property that does not have corresponding setter method. |
void |
setNonStandardProperty(java.lang.String key,
java.lang.String value)
Set the property that does not have corresponding setter method. |
void |
setPassword(java.lang.String password)
Set password that will be used in the getConnection() method. |
void |
setReference(javax.naming.Reference reference)
Set JNDI reference for this data source. |
void |
setRoleName(java.lang.String roleName)
|
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlDialect(java.lang.String sqlDialect)
|
void |
setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
|
void |
setTpbMapping(java.lang.String tpbMapping)
Set path to the properties file with the TPB mapping. |
void |
setTransactionParameters(int isolation,
TransactionParameterBuffer tpb)
Set transaction parameters for the specified transaction isolation level. |
void |
setType(java.lang.String type)
|
void |
setUser(java.lang.String user)
Deprecated. use setUserName(String) instead for the sake of
naming compatibility. |
void |
setUserName(java.lang.String userName)
Set user name that will be used in getConnection() method. |
void |
setUseStandardUdf(boolean useStandardUdf)
|
void |
setUseStreamBlobs(boolean useStreamBlobs)
|
void |
setUseTranslation(java.lang.String translationPath)
|
java.lang.Object |
unwrap(java.lang.Class arg0)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient FBManagedConnectionFactory mcf
protected transient FBDataSource ds
protected transient java.io.PrintWriter log
protected javax.naming.Reference jndiReference
protected java.lang.String description
protected int loginTimeout
Constructor Detail |
---|
public FBSimpleDataSource()
public FBSimpleDataSource(org.firebirdsql.gds.impl.GDSType type)
Method Detail |
---|
public java.lang.Integer getBlobBufferLength()
public void setBlobBufferLength(java.lang.Integer length)
length
- new length of the BLOB buffer.public java.lang.String getDatabaseName()
getDatabase()
instead for the sake of naming
compatibility.
jdbc:firebirdsql:
part.public void setDatabaseName(java.lang.String name)
setDatabase(String)
instead for the sake of
naming compatibility.
name
- connection URL without "jdbc:firebirdsql:"
prefix ("//localhost:3050/c:/database/employee.gdb"
) for
example).public java.lang.String getDatabase()
getDatabase
in interface FirebirdConnectionProperties
jdbc:firebirdsql:
part.public void setDatabase(java.lang.String name)
setDatabase
in interface FirebirdConnectionProperties
name
- connection URL without "jdbc:firebirdsql:"
prefix ("//localhost:3050/c:/database/employee.gdb"
) for
example).public java.lang.String getUser()
getUserName()
instead for the sake of naming
compatibility.
getConnection()
method.
public void setUser(java.lang.String user)
setUserName(String)
instead for the sake of
naming compatibility.
getConnection()
method.
user
- default user name.public java.lang.String getUserName()
getConnection()
method.
getUserName
in interface FirebirdConnectionProperties
public void setUserName(java.lang.String userName)
getConnection()
method.
setUserName
in interface FirebirdConnectionProperties
userName
- default user name.public java.lang.String getPassword()
getConnection()
method.
getPassword
in interface FirebirdConnectionProperties
getUserName()
.public void setPassword(java.lang.String password)
getConnection()
method.
setPassword
in interface FirebirdConnectionProperties
password
- password corresponding to the user name set in
setUserName(String)
.public java.lang.String getEncoding()
getEncoding
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setEncoding(String)
public void setEncoding(java.lang.String encoding)
setEncoding
in interface FirebirdConnectionProperties
encoding
- encoding for the connection.public java.lang.String getTpbMapping()
FirebirdConnectionProperties
getTpbMapping
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setTpbMapping(String)
public void setTpbMapping(java.lang.String tpbMapping)
FirebirdConnectionProperties
"res:"
should be used to specify resource
in the classpath.
For the compatibility reasons, if no protocol is specified, classpath is used by default.
Properties file contains a mapping between the transaction isolation
level (name of the constant in the Connection
interface
and a comma-separated list of TPB parameters.
setTpbMapping
in interface FirebirdConnectionProperties
tpbMapping
- path to the properties file.public int getBlobBufferSize()
getBlobBufferSize
in interface FirebirdConnectionProperties
public int getBuffersNumber()
getBuffersNumber
in interface FirebirdConnectionProperties
public java.lang.String getCharSet()
getCharSet
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setCharSet(String)
public DatabaseParameterBuffer getDatabaseParameterBuffer() throws java.sql.SQLException
FirebirdConnectionProperties
getDatabaseParameterBuffer
in interface FirebirdConnectionProperties
DatabaseParameterBuffer
.
java.sql.SQLException
- if database parameter buffer cannot be created.public java.lang.String getDefaultIsolation()
FirebirdConnectionProperties
FirebirdConnectionProperties.getDefaultTransactionIsolation()
, however
it takes a string as parameter instead of a numeric constant.
getDefaultIsolation
in interface FirebirdConnectionProperties
FirebirdConnectionProperties.setDefaultIsolation(String)
public int getDefaultTransactionIsolation()
FirebirdConnectionProperties
getDefaultTransactionIsolation
in interface FirebirdConnectionProperties
public java.lang.String getNonStandardProperty(java.lang.String key)
FirebirdConnectionProperties
getNonStandardProperty
in interface FirebirdConnectionProperties
key
- name of the property to get.
public java.lang.String getRoleName()
getRoleName
in interface FirebirdConnectionProperties
public int getSocketBufferSize()
getSocketBufferSize
in interface FirebirdConnectionProperties
public java.lang.String getSqlDialect()
getSqlDialect
in interface FirebirdConnectionProperties
public TransactionParameterBuffer getTransactionParameters(int isolation)
FirebirdConnectionProperties
getTransactionParameters
in interface FirebirdConnectionProperties
isolation
- transaction isolation level for which TPB should be returned.
TransactionParameterBuffer
.public java.lang.String getType()
getType
in interface FirebirdConnectionProperties
public java.lang.String getUseTranslation()
getUseTranslation
in interface FirebirdConnectionProperties
public boolean isTimestampUsesLocalTimezone()
isTimestampUsesLocalTimezone
in interface FirebirdConnectionProperties
true
if the Jaybird 1.0 handling of the calendar
in corresponding setters. This is also compatible with MySQL
calendar treatment.public boolean isUseStandardUdf()
isUseStandardUdf
in interface FirebirdConnectionProperties
true
if driver should assume that standard UDF are
installed.public boolean isUseStreamBlobs()
isUseStreamBlobs
in interface FirebirdConnectionProperties
true
if stream blobs should be created, otherwise
false
.public void setBlobBufferSize(int bufferSize)
setBlobBufferSize
in interface FirebirdConnectionProperties
bufferSize
- size of the BLOB buffer in bytes.public void setBuffersNumber(int buffersNumber)
setBuffersNumber
in interface FirebirdConnectionProperties
buffersNumber
- number of cache buffers that should be allocated for this
connection, should be specified for ClassicServer instances,
SuperServer has a server-wide configuration parameter.public void setCharSet(java.lang.String charSet)
setCharSet
in interface FirebirdConnectionProperties
charSet
- Character set for the connection. Similar to
encoding
property, but accepts Java names
instead of Firebird ones.public void setDefaultIsolation(java.lang.String isolation)
FirebirdConnectionProperties
FirebirdConnectionProperties.setDefaultTransactionIsolation(int)
,
however it takes a string as parameter instead of a numeric constant.
Following strings are allowed:
"TRANSACTION_READ_COMMITTED"
for a READ COMMITTED
isolation level.
"TRANSACTION_REPEATABLE_READ"
for a REPEATABLE READ
isolation level.
"TRANSACTION_SERIALIZABLE"
for a SERIALIZABLE
isolation level.
setDefaultIsolation
in interface FirebirdConnectionProperties
isolation
- string constant representing a default isolation level.public void setDefaultTransactionIsolation(int defaultIsolationLevel)
FirebirdConnectionProperties
setDefaultTransactionIsolation
in interface FirebirdConnectionProperties
defaultIsolationLevel
- default transaction isolation level.public void setNonStandardProperty(java.lang.String key, java.lang.String value)
FirebirdConnectionProperties
setNonStandardProperty
in interface FirebirdConnectionProperties
key
- name of the property to set.value
- value of the property.public void setNonStandardProperty(java.lang.String propertyMapping)
FirebirdConnectionProperties
setNonStandardProperty
in interface FirebirdConnectionProperties
propertyMapping
- parameter value in the ?propertyName[=propertyValue]? form,
this allows setting non-standard parameters using
configuration files.public void setRoleName(java.lang.String roleName)
setRoleName
in interface FirebirdConnectionProperties
roleName
- SQL role to use.public void setSocketBufferSize(int socketBufferSize)
setSocketBufferSize
in interface FirebirdConnectionProperties
socketBufferSize
- socket buffer size in bytes.public void setSqlDialect(java.lang.String sqlDialect)
setSqlDialect
in interface FirebirdConnectionProperties
sqlDialect
- SQL dialect of the client.public void setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
setTimestampUsesLocalTimezone
in interface FirebirdConnectionProperties
timestampUsesLocalTimezone
- true
if the Jaybird 1.0 handling of the
calendar in corresponding setters. This is also compatible
with MySQL calendar treatment.public void setTransactionParameters(int isolation, TransactionParameterBuffer tpb)
FirebirdConnectionProperties
setTransactionParameters
in interface FirebirdConnectionProperties
isolation
- transaction isolation level.tpb
- instance of TransactionParameterBuffer
containing
transaction parameters.public void setType(java.lang.String type)
setType
in interface FirebirdConnectionProperties
type
- type of the connection, for example, "PURE_JAVA", "LOCAL",
"EMBEDDED", depends on the GDS implementations installed in the system.public void setUseStandardUdf(boolean useStandardUdf)
setUseStandardUdf
in interface FirebirdConnectionProperties
useStandardUdf
- true
if driver should assume that standard UDF
are installed.public void setUseStreamBlobs(boolean useStreamBlobs)
setUseStreamBlobs
in interface FirebirdConnectionProperties
useStreamBlobs
- true
if stream blobs should be created,
otherwise false
.public void setUseTranslation(java.lang.String translationPath)
setUseTranslation
in interface FirebirdConnectionProperties
translationPath
- path to the character translation table.public boolean isDefaultResultSetHoldable()
isDefaultResultSetHoldable
in interface FirebirdConnectionProperties
public void setDefaultResultSetHoldable(boolean isHoldable)
setDefaultResultSetHoldable
in interface FirebirdConnectionProperties
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
Reference
set previously.
javax.naming.NamingException
- if something went wrong.public void setReference(javax.naming.Reference reference)
reference
- reference to set.public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if something went wrong.public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
username
- user name for the connection.password
- password for the connection.
java.sql.SQLException
- if something went wrong.public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
- if something went wrong.public void setLogWriter(java.io.PrintWriter log) throws java.sql.SQLException
setLogWriter
in interface javax.sql.DataSource
log
- instance of PrintWriter
that should be associated
with this datasource.
java.sql.SQLException
- if something went wrong.public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
- if something went wrong.public void setLoginTimeout(int loginTimeout) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
loginTimeout
- login timeout in seconds.
java.sql.SQLException
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- description of this datasource.protected javax.sql.DataSource getDataSource() throws java.sql.SQLException
FBDataSource
class) that will provide JDBC connections.
java.sql.SQLException
- if something went wrong.public boolean isWrapperFor(java.lang.Class arg0) throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object unwrap(java.lang.Class arg0) throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |