|
Re: jdbc driver for mysql database
|
Posted: Sep 24, 2002 2:33 AM
|
|
Try to download drivers from this link and try to use the data base: http://mmmysql.sourceforge.net/oldDist.html
the version u need to downlaod is: mm.mysql-2.0.4-bin.jar
Regards, Rajeev > I have a mysql database called mysql to which I?m > trying to connect without success. > I have a java class called Conectar.The error message > is: > Error in database java.sql.SQLException: No suitable > driver > Exception in thread "main" > java.lang.NullPointerException > at Conectar.main(Conectar.java:26) > > The class code is: > > import java.sql.*; > import java.io.*; > class Conectar{ > public static void main(String [] args) > { > Connection con = null; > > try { > > > > > > > > Class.forName("com.mysql.jdbc.Driver").newInstance(); > > }catch (ClassNotFoundException e){ > System.err.print("ClassNotFoundException: ") ; > : ") ; > System.err.println(e.getMessage()) ; > return ; > }catch(IllegalAccessException iae){ > }catch(InstantiationException ie){} > try{ > con = > con = > = > DriverManager.getConnection("jdbc:mysql:mysql","",""); > > > } > catch (SQLException e){ > System.err.println("Error in database " + > ase " + e); > } > finally { > try{ con.close() ; > } catch(SQLException ex) { > System.err.println("SQLException: " + > ion: " + ex.getMessage()) ; > } > } > } > } > > > I have downloaded MySQL Connector/J 2.0.14 and > installed it. All the classes are in a directory and > such directory is in the classpath. > Does anybody know what?s going on?Thank you in > advance.
|
|