Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

MS Access Driver

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
I'm new in JDBC can any 1 tell me how can i access data of ms access. pls write with sample code. my data base name is accounts. Thnx
===
FAF
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest way is to set up your access db with an ODBC (microsoft stuff) service. Then you can use the JDBC-ODBC bridge to get java to talk to ODBC.
You should be able to set this up in the OCBD section of the control panel, then use the sun.jdbc.odbc.JdbcOdbcDriver with the url "jdbc: odbc:accounts"
I have some sample code but I can't get to it at the moment :}
Apart from the ODBC stuff it's all the same anyways.
Dave.
[This message has been edited by David O'Meara (edited July 22, 2001).]
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
u can try something likethis.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:accounts") ;
/* assume that accounts is ur dsn */
Statement stmt = con.createStatement();
then u can get resultset object with this statement object
hope this helps
prashant
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be aware that the jdbc.odbc bridge has some significant restrictions, it is a type 1 driver which means you can only ever go forward through a result set, it does not understand the Access memo data type and it has problems with threading.
Link to some typical code
http://developer.java.sun.com/developer/techDocs/SearchData/qa/JDBC-ODBC_Bridge.html
 
prashant komaragiri
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
u can try something likethis.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:accounts") ;
/* assume that accounts is ur dsn */
Statement stmt = con.createStatement();
then u can get resultset object with this statement object
hope this helps
prashant
 
Faisal Farooqui
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sun.jdbc.odbc.JdbcOdbcDriver
is it included in JDK 1.3/ 1.4 (beta)? I got an error "class file not found". Would have i to download drivers for JDBC if so where can i find these drivers.
thanks every 1 for reply
===
FAF
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Faisal, the sun.jdbc.odbc.JdbcOdbcDriver is included with the JDK. You will need to set up your DSN though so that your program can access your DB. You will need to do this through the ODBC settings in control panel. There is a JDBC tutorial at Sun's site that can help you with this.

Bosun
 
I do some of my very best work in water. Like this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic