|
||||||||||
| 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 String |
description
|
protected FBDataSource |
ds
|
protected Reference |
jndiReference
|
protected PrintWriter |
log
|
protected int |
loginTimeout
|
protected FBManagedConnectionFactory |
mcf
|
| Constructor Summary | |
|---|---|
FBSimpleDataSource()
Create instance of this class. |
|
FBSimpleDataSource(GDSType type)
Create instance of this class. |
|
| Method Summary | |
|---|---|
Integer |
getBlobBufferLength()
Get buffer length for the BLOB fields. |
int |
getBlobBufferSize()
|
int |
getBuffersNumber()
|
String |
getCharSet()
|
Connection |
getConnection()
Get JDBC connection with default credentials. |
Connection |
getConnection(String username,
String password)
Get JDBC connection with the specified credentials. |
String |
getDatabase()
Get name of the database. |
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 DataSource |
getDataSource()
Get underlying connection factory (in our case instance of FBDataSource class) that will provide JDBC connections. |
String |
getDefaultIsolation()
Get the default transaction isolation level as string. |
int |
getDefaultTransactionIsolation()
Get the default transaction isolation level. |
String |
getDescription()
Get description of this datasource. |
String |
getEncoding()
Get encoding for connections produced by this data source. |
int |
getLoginTimeout()
Get login timeout specified for this datasource. |
PrintWriter |
getLogWriter()
Get log for this datasource. |
String |
getNonStandardProperty(String key)
Get the property that does not have corresponding getter method by its name. |
String |
getPassword()
Get password used in getConnection() method. |
Reference |
getReference()
Get previously set JNDI reference. |
String |
getRoleName()
|
int |
getSocketBufferSize()
|
String |
getSqlDialect()
|
String |
getTpbMapping()
Get the used TPB mapping. |
TransactionParameterBuffer |
getTransactionParameters(int isolation)
Get the transaction parameter buffer corresponding to the current connection request information. |
String |
getType()
|
String |
getUser()
Deprecated. use getUserName() instead for the sake of naming
compatibility. |
String |
getUserName()
Get user name that is used in getConnection() method. |
String |
getUseTranslation()
|
boolean |
isDefaultResultSetHoldable()
|
boolean |
isTimestampUsesLocalTimezone()
|
boolean |
isUseStandardUdf()
|
boolean |
isUseStreamBlobs()
|
boolean |
isWrapperFor(Class arg0)
|
void |
setBlobBufferLength(Integer length)
Set BLOB buffer length. |
void |
setBlobBufferSize(int bufferSize)
|
void |
setBuffersNumber(int buffersNumber)
|
void |
setCharSet(String charSet)
|
void |
setDatabase(String name)
Set database name. |
void |
setDatabaseName(String name)
Deprecated. use setDatabase(String) instead for the sake of
naming compatibility. |
void |
setDefaultIsolation(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(String description)
Set description of this datasource. |
void |
setEncoding(String encoding)
Set encoding for connections produced by this data source. |
void |
setLoginTimeout(int loginTimeout)
Set login timeout for this datasource. |
void |
setLogWriter(PrintWriter log)
Set log for this datasource. |
void |
setNonStandardProperty(String propertyMapping)
Set the property that does not have corresponding setter method. |
void |
setNonStandardProperty(String key,
String value)
Set the property that does not have corresponding setter method. |
void |
setPassword(String password)
Set password that will be used in the getConnection() method. |
void |
setReference(Reference reference)
Set JNDI reference for this data source. |
void |
setRoleName(String roleName)
|
void |
setSocketBufferSize(int socketBufferSize)
|
void |
setSqlDialect(String sqlDialect)
|
void |
setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
|
void |
setTpbMapping(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(String type)
|
void |
setUser(String user)
Deprecated. use setUserName(String) instead for the sake of
naming compatibility. |
void |
setUserName(String userName)
Set user name that will be used in getConnection() method. |
void |
setUseStandardUdf(boolean useStandardUdf)
|
void |
setUseStreamBlobs(boolean useStreamBlobs)
|
void |
setUseTranslation(String translationPath)
|
Object |
unwrap(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 PrintWriter log
protected Reference jndiReference
protected String description
protected int loginTimeout
| Constructor Detail |
|---|
public FBSimpleDataSource()
public FBSimpleDataSource(GDSType type)
| Method Detail |
|---|
public Integer getBlobBufferLength()
public void setBlobBufferLength(Integer length)
length - new length of the BLOB buffer.public String getDatabaseName()
getDatabase() instead for the sake of naming
compatibility.
jdbc:firebirdsql: part.public void setDatabaseName(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 String getDatabase()
getDatabase in interface FirebirdConnectionPropertiesjdbc:firebirdsql: part.public void setDatabase(String name)
setDatabase in interface FirebirdConnectionPropertiesname - connection URL without "jdbc:firebirdsql:"
prefix ("//localhost:3050/c:/database/employee.gdb") for
example).public String getUser()
getUserName() instead for the sake of naming
compatibility.
getConnection() method.
public void setUser(String user)
setUserName(String) instead for the sake of
naming compatibility.
getConnection() method.
user - default user name.public String getUserName()
getConnection() method.
getUserName in interface FirebirdConnectionPropertiespublic void setUserName(String userName)
getConnection() method.
setUserName in interface FirebirdConnectionPropertiesuserName - default user name.public String getPassword()
getConnection() method.
getPassword in interface FirebirdConnectionPropertiesgetUserName().public void setPassword(String password)
getConnection() method.
setPassword in interface FirebirdConnectionPropertiespassword - password corresponding to the user name set in
setUserName(String).public String getEncoding()
getEncoding in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setEncoding(String)public void setEncoding(String encoding)
setEncoding in interface FirebirdConnectionPropertiesencoding - encoding for the connection.public String getTpbMapping()
FirebirdConnectionProperties
getTpbMapping in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setTpbMapping(String)public void setTpbMapping(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 FirebirdConnectionPropertiestpbMapping - path to the properties file.public int getBlobBufferSize()
getBlobBufferSize in interface FirebirdConnectionPropertiespublic int getBuffersNumber()
getBuffersNumber in interface FirebirdConnectionPropertiespublic String getCharSet()
getCharSet in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setCharSet(String)
public DatabaseParameterBuffer getDatabaseParameterBuffer()
throws SQLException
FirebirdConnectionProperties
getDatabaseParameterBuffer in interface FirebirdConnectionPropertiesDatabaseParameterBuffer.
SQLException - if database parameter buffer cannot be created.public String getDefaultIsolation()
FirebirdConnectionPropertiesFirebirdConnectionProperties.getDefaultTransactionIsolation(), however
it takes a string as parameter instead of a numeric constant.
getDefaultIsolation in interface FirebirdConnectionPropertiesFirebirdConnectionProperties.setDefaultIsolation(String)public int getDefaultTransactionIsolation()
FirebirdConnectionProperties
getDefaultTransactionIsolation in interface FirebirdConnectionPropertiespublic String getNonStandardProperty(String key)
FirebirdConnectionProperties
getNonStandardProperty in interface FirebirdConnectionPropertieskey - name of the property to get.
public String getRoleName()
getRoleName in interface FirebirdConnectionPropertiespublic int getSocketBufferSize()
getSocketBufferSize in interface FirebirdConnectionPropertiespublic String getSqlDialect()
getSqlDialect in interface FirebirdConnectionPropertiespublic TransactionParameterBuffer getTransactionParameters(int isolation)
FirebirdConnectionProperties
getTransactionParameters in interface FirebirdConnectionPropertiesisolation - transaction isolation level for which TPB should be returned.
TransactionParameterBuffer.public String getType()
getType in interface FirebirdConnectionPropertiespublic String getUseTranslation()
getUseTranslation in interface FirebirdConnectionPropertiespublic boolean isTimestampUsesLocalTimezone()
isTimestampUsesLocalTimezone in interface FirebirdConnectionPropertiestrue 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 FirebirdConnectionPropertiestrue if driver should assume that standard UDF are
installed.public boolean isUseStreamBlobs()
isUseStreamBlobs in interface FirebirdConnectionPropertiestrue if stream blobs should be created, otherwise
false.public void setBlobBufferSize(int bufferSize)
setBlobBufferSize in interface FirebirdConnectionPropertiesbufferSize - size of the BLOB buffer in bytes.public void setBuffersNumber(int buffersNumber)
setBuffersNumber in interface FirebirdConnectionPropertiesbuffersNumber - 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(String charSet)
setCharSet in interface FirebirdConnectionPropertiescharSet - Character set for the connection. Similar to
encoding property, but accepts Java names
instead of Firebird ones.public void setDefaultIsolation(String isolation)
FirebirdConnectionPropertiesFirebirdConnectionProperties.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 FirebirdConnectionPropertiesisolation - string constant representing a default isolation level.public void setDefaultTransactionIsolation(int defaultIsolationLevel)
FirebirdConnectionProperties
setDefaultTransactionIsolation in interface FirebirdConnectionPropertiesdefaultIsolationLevel - default transaction isolation level.
public void setNonStandardProperty(String key,
String value)
FirebirdConnectionProperties
setNonStandardProperty in interface FirebirdConnectionPropertieskey - name of the property to set.value - value of the property.public void setNonStandardProperty(String propertyMapping)
FirebirdConnectionProperties
setNonStandardProperty in interface FirebirdConnectionPropertiespropertyMapping - parameter value in the ?propertyName[=propertyValue]? form,
this allows setting non-standard parameters using
configuration files.public void setRoleName(String roleName)
setRoleName in interface FirebirdConnectionPropertiesroleName - SQL role to use.public void setSocketBufferSize(int socketBufferSize)
setSocketBufferSize in interface FirebirdConnectionPropertiessocketBufferSize - socket buffer size in bytes.public void setSqlDialect(String sqlDialect)
setSqlDialect in interface FirebirdConnectionPropertiessqlDialect - SQL dialect of the client.public void setTimestampUsesLocalTimezone(boolean timestampUsesLocalTimezone)
setTimestampUsesLocalTimezone in interface FirebirdConnectionPropertiestimestampUsesLocalTimezone - 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 FirebirdConnectionPropertiesisolation - transaction isolation level.tpb - instance of TransactionParameterBuffer containing
transaction parameters.public void setType(String type)
setType in interface FirebirdConnectionPropertiestype - 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 FirebirdConnectionPropertiesuseStandardUdf - true if driver should assume that standard UDF
are installed.public void setUseStreamBlobs(boolean useStreamBlobs)
setUseStreamBlobs in interface FirebirdConnectionPropertiesuseStreamBlobs - true if stream blobs should be created,
otherwise false.public void setUseTranslation(String translationPath)
setUseTranslation in interface FirebirdConnectionPropertiestranslationPath - path to the character translation table.public boolean isDefaultResultSetHoldable()
isDefaultResultSetHoldable in interface FirebirdConnectionPropertiespublic void setDefaultResultSetHoldable(boolean isHoldable)
setDefaultResultSetHoldable in interface FirebirdConnectionProperties
public Reference getReference()
throws NamingException
getReference in interface ReferenceableReference set previously.
NamingException - if something went wrong.public void setReference(Reference reference)
reference - reference to set.
public Connection getConnection()
throws SQLException
getConnection in interface DataSourceSQLException - if something went wrong.
public Connection getConnection(String username,
String password)
throws SQLException
getConnection in interface DataSourceusername - user name for the connection.password - password for the connection.
SQLException - if something went wrong.
public PrintWriter getLogWriter()
throws SQLException
getLogWriter in interface CommonDataSourceSQLException - if something went wrong.
public void setLogWriter(PrintWriter log)
throws SQLException
setLogWriter in interface CommonDataSourcelog - instance of PrintWriter that should be associated
with this datasource.
SQLException - if something went wrong.
public int getLoginTimeout()
throws SQLException
getLoginTimeout in interface CommonDataSourceSQLException - if something went wrong.
public void setLoginTimeout(int loginTimeout)
throws SQLException
setLoginTimeout in interface CommonDataSourceloginTimeout - login timeout in seconds.
SQLExceptionpublic String getDescription()
public void setDescription(String description)
description - description of this datasource.
protected DataSource getDataSource()
throws SQLException
FBDataSource class) that will provide JDBC connections.
SQLException - if something went wrong.
public boolean isWrapperFor(Class arg0)
throws SQLException
isWrapperFor in interface WrapperSQLException
public Object unwrap(Class arg0)
throws SQLException
unwrap in interface WrapperSQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||