Insert into database
Hi I use mysql database and my code is: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:bookdsn"); Statement st=cn.createStatement(); String query="Insert into book (Bname,Bsubject,Bshabok,Bwriter)values('H','D','1234','AA')"; st.executeUpdate(query); st.close(); cn.close(); It compile without error but got this runtime error: Exception in thread "main" java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at BookDatabase.main(BookDatabase.java:6) What is reason?