Here is a small function example, which loads a combobox with data from an access database:void updateType() {
// Load the
JDBC driver class
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
// Connect to the database
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = DriverManager.getConnection("jdbc
dbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=ETPScripts.mdb;PWD=mypass", "login", "password");
stmt = con.createStatement();
// Run a query
rs = stmt.executeQuery("select * from Type");
while (rs.next()) {
String description = rs.getString(2);
}
}
catch (Exception ex) {
System.out.println("Error");
}
finally {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
if (con != null) {
con.close();
}
}
}
catch (Exception ex) {
System.out.println("Error");
}
}
Let me know, if you need anything else.
Dean