public class JdbcDataSource extends NFEAbstractDataSource implements NFEConnectionDataSource
Example to use it:
//Initialize the datasource JdbcDataSource dataSource = new JdbcDataSource(); DbConnectionData connectionData = new DbConnectionData(); connectionData.setHost("localhost"); connectionData.setJdbcDriverMode("thin"); connectionData.setPort("1521"); connectionData.setSid("view"); connectionData.setUserName(""); connectionData.setPassword(""); dataSource.setConnectionData(connectionData); dataSource.setActiveWorkspace(NFEConstants.DEFAULT_PARENT_WORKSPACE); dataSource.initDatasource();
Constructor and Description |
---|
JdbcDataSource() |
Modifier and Type | Method and Description |
---|---|
void |
closeDataSource()
Closes this data source.
|
DbConnectionData |
getConnectionData()
Gets the connection data.
|
java.sql.Connection |
getConnectionWihoutWorkspaceHandling()
Obtains a connection from the Pool Data Source.
|
void |
initDatasource()
Initializes the Pool Data Source to be able to serve DB connections.
|
void |
setConnectionData(DbConnectionData connectionData)
Sets the connection data.
|
void |
testConnection()
Tests a connection to the database.
|
getActiveWorkspace, getConnection, setActiveWorkspace
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getActiveWorkspace, getConnection, setActiveWorkspace
public void initDatasource() throws InvalidDBConnectionException
initDatasource
in interface NFEConnectionDataSource
InvalidDBConnectionException
- if the connection is not valid.public void closeDataSource()
public java.sql.Connection getConnectionWihoutWorkspaceHandling() throws InvalidDBConnectionException
getConnectionWihoutWorkspaceHandling
in class NFEAbstractDataSource
InvalidDBConnectionException
- if the connection is not valid.public DbConnectionData getConnectionData()
public void setConnectionData(DbConnectionData connectionData)
NFEConnectionDataSource
setConnectionData
in interface NFEConnectionDataSource
connectionData
- the data for the connectionpublic void testConnection() throws java.lang.Exception
NFEConnectionDataSource
testConnection
in interface NFEConnectionDataSource
java.lang.Exception
- thrown if something goes wrong with the test.