public class MsAccessDbConnector 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 |
password |
private java.lang.String |
username |
Constructor and Description |
---|
MsAccessDbConnector(java.lang.String dbName,
java.lang.String username,
java.lang.String password)
Constructor of DbConnector implementation class for establishing a connection to a MSAccess database.
|
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 MSAccess database.
|
java.lang.String |
getDatabaseUrl()
Returns the Database URL.
|
private java.sql.Connection |
openConnection()
Establishes a connection to the MSAccess database.
|
private java.lang.String dbName
private java.lang.String username
private java.lang.String password
private java.sql.Connection connection
public MsAccessDbConnector(java.lang.String dbName, java.lang.String username, java.lang.String password)
dbName
- Full path to the MSAccess database.username
- The user name to access the database (if applicable).password
- The password to access the database (if applicable).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()