A compile error message is not intended to be a hindrance, more so,
informative. It is useful to read the information that the compiler gives
you.
"exception java.lang.ClassNotFoundException; must be caught or declared
to be thrown Class.forName("com.mysql.jdbc.Driver").newInstance ();"
This means that a checked exception called java.lang.ClassNotFoundException
must be declared to be caught or thrown when you call
Class.forName("com.blah").newInstance();
If you don't understand what this means, I strongly suggest that you learn
the fundamentals of exception handling in Java before using JDBC:
http://java.sun.com/docs/books/tutor...al/exceptions/
Good luck.
--
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
"Claudio Penasio Junior" <> wrote in message
news: om...
> Hello all
>
> I can't connect on MySQL whith MySQL Connector/J...
>
> code frame...
> ------------------------------------------------------
> String url = "jdbc:mysql://localhost:3306/banco";
> String login = "blah";
> String pass = "blah";
> Class.forName("com.mysql.jdbc.Driver").newInstance ();
> Connection con = DriverManager.getConnection(url,login,pass);
>
> --------------------------------------------------------------
>
> Error:
> --------------------------------------------------------------
> loja/BDLoja.java [31:1] unreported
> exceptionjava.lang.ClassNotFoundException; must be caught or declared
> to bethrownClass.forName("com.mysql.jdbc.Driver").new Instance();
>
> ------------------------------------------------------------------
>
> I put the mysql-connector-java-3.0.9-stable-bin.jar on my CLASSPATH, i
> read n times the README, and dont work. Somebody can help me?