public class DB2DbConnector extends java.lang.Object implements DbConnector
Modifier and Type | Field and Description |
---|---|
private java.sql.Connection |
connection |
private java.lang.String |
dbName |
private java.lang.String |
encoding |
private java.lang.String |
host |
private java.lang.String |
password |
private int |
port |
private java.lang.String |
username |
Constructor and Description |
---|
DB2DbConnector(java.lang.String host,
int port,
java.lang.String dbName,
java.lang.String username,
java.lang.String password,
java.lang.String encoding)
Constructor of DbConnector implementation class for establishing a connection to an IBM DB2 database with the Spatial Extender.
|
Modifier and Type | Method and Description |
---|---|
void |
closeConnection()
Closes the connection to the MSAccess database.
|
java.sql.ResultSet |
executeQuery(java.lang.String query)
Returns the result of the SQL query executed against the IBM DB2 database.
|
java.lang.String |
getDatabaseUrl()
Returns the Database URL.
|
private java.sql.Connection |
openConnection()
Establishes a connection to the IBM DB2 database.
|
private java.lang.String host
private int port
private java.lang.String dbName
private java.lang.String username
private java.lang.String password
private java.lang.String encoding
private java.sql.Connection connection
public DB2DbConnector(java.lang.String host, int port, java.lang.String dbName, java.lang.String username, java.lang.String password, java.lang.String encoding)
host
- The IP of the machine where the database is hosted.port
- The port where the database is listening.dbName
- The name of the database to connect to.username
- The user name credential to access the database.password
- The password credential to access the database.encoding
- The character encoding used in the database.public java.lang.String getDatabaseUrl()
getDatabaseUrl
in interface DbConnector
public java.sql.ResultSet executeQuery(java.lang.String query)
executeQuery
in interface DbConnector
query
- A SQL command for the SELECT query.public void closeConnection()
closeConnection
in interface DbConnector
private java.sql.Connection openConnection()