|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jameleon.data.SqlDataDriver
public class SqlDataDriver
Am implementation of @{link DataDriver} for SQL.
Field Summary | |
---|---|
protected Connection |
conn
|
protected String |
jdbcDriver
|
protected List |
keys
|
protected String |
password
|
protected String |
query
|
protected ResultSet |
rs
|
protected Statement |
stmt
|
protected String |
url
|
protected String |
username
|
Constructor Summary | |
---|---|
SqlDataDriver()
Default construtor. |
|
SqlDataDriver(String url,
String jdbcDriver,
String username,
String password)
Sets up all required fields. |
Method Summary | |
---|---|
void |
close()
Closes the handle to the data source |
void |
executeQuery()
Executes a query against the database once a valid connection has been established. |
Map |
getNextRow()
Gets the next row from the data source |
boolean |
hasMoreRows()
Tells whether the data source has another row |
void |
open()
Opens the handle to the data source |
protected void |
readRecord()
|
protected void |
registerJDBCDriver()
|
void |
setJDBCDriver(String jdbcDriver)
Sets the JDBC Driver. |
void |
setJDBCPassword(String password)
Sets the JDBC password. |
void |
setJDBCUrl(String url)
Sets the JDBC url. |
void |
setJDBCUsername(String username)
Sets the JDBC username. |
protected void |
setKeys()
Gets MetaData from the result set and builds an ArrayList of the Column headers |
void |
setQuery(String query)
Sets the SQL Query. |
protected void |
validate()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String url
protected String jdbcDriver
protected String username
protected String password
protected String query
protected Connection conn
protected List keys
protected Statement stmt
protected ResultSet rs
Constructor Detail |
---|
public SqlDataDriver()
setJDBCDriver(java.lang.String)
setJDBCUrl(java.lang.String)
public SqlDataDriver(String url, String jdbcDriver, String username, String password)
url
- - the jdbc url used to connect to the databasejdbcDriver
- - the jdbc driver used to connect to the databaseusername
- - the username used to connect to the databasepassword
- - the password used to connect to the databaseMethod Detail |
---|
public void close()
close
in interface DataDriver
public void open() throws IOException
open
in interface DataDriver
IOException
- when the data source can not be found.protected void validate()
protected void registerJDBCDriver() throws IOException
IOException
protected void readRecord() throws SQLException
SQLException
public void executeQuery() throws SQLException
SQLException
- if there is no query defined.protected void setKeys()
public Map getNextRow()
getNextRow
in interface DataDriver
public boolean hasMoreRows()
hasMoreRows
in interface DataDriver
public void setJDBCDriver(String jdbcDriver)
public void setJDBCUrl(String url)
public void setJDBCUsername(String username)
public void setJDBCPassword(String password)
public void setQuery(String query)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |