This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Aravind is recommending you use the JDBC-ODBC bridge. I strongly recommend that you do not.
You are trying to connect to the MySQL file for some reason. MySQL runs as a server, and you have to connect to it as such. Therefore your Database url will look similar to this: String database="jdbc:mysql://localhost:test";
But this is a database server, that you should be refering to, not a file. When you talk to a web app, you need to get the browser to talk to the server even if that server is running on the local computer, Sure, you could access the files directly, but it wouldn't work.
Same with MySQL. This is not MSAccess. You can get to an Access DB directly via the file, but this is because Access is not designed for large scalable systems like other Databases are.
SO you need to make sure the MySQL database server is running and then connect using the url I gave above.
I did get distracted from you original error, which is "ClassNotFound". It looks like you're using the wrong classname foir that driver, try "com.mysql.jdbc.Driver"
I am sorry but i am getting the following error at line B even when i used "com.mysql.jdbc.Driver" in line A
java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at conn.getConnection(conn.java:30) ----------B at conn.update(conn.java:69) at conn.main(conn.java:96) Exception in thread "main" java.lang.NullPointerException at conn.update(conn.java:75) at conn.main(conn.java:96)
i really appreciate ur help. [ April 01, 2006: Message edited by: pree sree ]