Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

MS Access Database

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone give me step by step instructions on how to use an access database from java. Starting with creating the odbc connection. I only want the database on my home PC?
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
G'day
Well what I would do is
1- Learn how to setup an ODBC that points to a Microsoft Access database
Check this website(first half of it)
ODBC setting
2- Go back to you JSP
The URL speifying how to connect to Microsoft ODBC database using JDBC
2-1 Load the driver to connect to the database
// some java code
// the unhappy face is simply : followed by O
// I assumed that u named the OBDC as AmandaODBC
String url = "JDBC DBC:AmandaODBC";
// the name and password u used when u created the ODBC
String password ="youpassword";
String username ="youname";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection myConnection = DriverManager.getConnection(url,username, password);
} catch( ClassNotFoundException cnfex) {
// some error messages here
System.err.println("Failed to conenct to JDBC/ODBC driver")
System.exit(1); // terminates the program
}
The rest should be normal JDBC code, u used the myconnection object to creat statement and use resultset to use the statement...........
Hope that helps...

[ February 02, 2003: Message edited by: Aussie man ]
[ February 02, 2003: Message edited by: Aussie man ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Aussie man"
We're pretty light on rules at the ranch, but the naming policy is one that we enforce.
Please check it out here and change your display name to comply. You ned to have your frst name, a space then your last name and obviously fictitious names aren't allowed.
Please change your display name soon, since accounts with invalid display names get deleted
and welcome!
Dave (aka the other Aussie man )
 
Mohammed Ali
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks 4 letting me know David.
[ February 03, 2003: Message edited by: Mohammed Ali ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the proper ODBC System DSN setup and i stil receive the error. My classpath is set for rt.jar. I installed MDAC 2.7.
 
"To do good, you actually have to do something." -- Yvon Chouinard
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic