• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MS Access - JDBC - ODBC - DAB's??

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I developed this application using VisualAge 2.0, and just hard-coded some DB objects so I could load lists and text boxes etc. Now I want to hook it up to an Access Database (easiest for starters I think).
I'm pretty confused on the steps I should take for the easiest setup. I'm told you don't have to code your DAB's directly....
Anyone help would be great, and maybe if someone were to offer me their msn or icq # and you were gonna be online, you could guide me a bit!?
i know its a lot to ask...but I'm desparate to learn this!
Thanks!
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Brett Swift
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for your help.
[ July 31, 2002: Message edited by: Brett Swift ]
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic