Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Accessing a Microsoft Access Database

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So how do you do this step by step?
Say that i've made a database and saved it.
Now what do i do?
I know there are some lines of code to actually open the database in a java application yet are there more steps i have to go through before i can even open it? I tried using some code i got from a site yet had no luck.
So step by step what do I do?
1, I saved the databade
Whats next?
Some code would be helfull too =] Thx alot.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! Kevin.....
here is ur step by step procedure to connect to an access DB...
1.) Create a system DSN for ur DataBase(*.mdb file)
to learn how to do this u can go thru this WebSite:
http://www.webwizguide.info/asp/tutorials/setting_up_dsn.asp
2.) In ur java code load the jdbc-odbc bridge driver in the following manner:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
3.) Create a connection using :
String url = "jdbc dbc:Ajay";
Connection con = DriverManager.getConnection(url,"myLogin", "myPassword");
where Ajay is ur system DSN name.and if u don't have any passord or login then ur connection variables wud be like this:
String url = "jdbc dbc:Ajay";
Connection con = DriverManager.getConnection(url,"", "");
4.) Next is creating statement objects and resultset objects......For complete info on this u can read the following tutorial..
http://www.interex.org/pubcontent/enterprise/jan00/14chew.html
5.) u can have look at this sample code :
Hope all this helps u solve ur problem.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic