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?
Mohammed Ali
Greenhorn
Joined: Feb 02, 2003
Posts: 4
posted
0
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 ]
"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
Joined: Feb 02, 2003
Posts: 4
posted
0
Thanks 4 letting me know David. [ February 03, 2003: Message edited by: Mohammed Ali ]
Jeff Hancock
Greenhorn
Joined: Nov 17, 2000
Posts: 11
posted
0
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.