Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsExecuting SQL statement
https://www.eclipse.org/forums/index.php/mv/msg/187186/593813/#msg_593813
Originally posted by: andi.hotz.adsl.li
Up until now when I was interested in the contents of a table I accessed
the contents through an SQL statement using the java.sql.* package.
With DTP this is something like the flowing:
IConnectionProfile profile;
....
String sql = "select * from some_table";
Connection conn = (Connection)
profile.createConnection("java.sql.Connection").getRawConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()){
// something found found so do something
} else {
// nothing found so do something else
}
} catch (SQLException e){
e.printStackTrace();
}
I noticed there are classes/interfaces like
org.eclipse.datatools.modelbase.sql.query.impl.QuerySelectSt atementImpl.
How can I make use of this to access the data in my database table while
ignoring the underling connection infrastructure (JDBC connection will
only work if the data source driver is a JDBC driver).
So here is the question: How do I access my data in an abstract way?