NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Zelig
Joined: 04 Apr 2009 Posts: 64 Location: FRANCE
|
Posted: Wed May 12, 2010 1:33 pm Post subject: Fail to establish the MySQL JDBC driver |
|
|
Hello everybody,
My problem is related to the use of the Connector JDBC for My SQL. In Netbeans, the driver appears and I can connect to my databases.
When I try to connect from a Java application, the command "Class.forName("com.mysql.jdbc.Driver")" triggers, at runtime, the following error message :
"java.lang.ClassNotFoundException : com.mysql.jdbc.Driver".
Can someone please help me? |
|
| Back to top |
|
 |
Peter Pis Posted via mailing list.
|
Posted: Wed May 12, 2010 2:15 pm Post subject: Fail to establish the MySQL JDBC driver |
|
|
Hi,
have you added "MySQL JDBC Driver" library to the project? (Select the
project from "Projects" view and invoke "Properties" popup menu action,
switch to "Libraries" category -> "Compile" tab. By pushing "Add
Library" you can add that lib)
HTH,
-Peter
Zelig wrote:
| Quote: | Hello everybody,
My problem is related to the use of the Connector JDBC for My SQL. In Netbeans, the driver appears and I can connect to my databases.
When I try to connect from a Java application, the command "Class.forName("com.mysql.jdbc.Driver")" triggers, at runtime, the following error message :
"java.lang.ClassNotFoundException : com.mysql.jdbc.Driver". [Crying or Very sad]
Can someone please help me?
|
|
|
| Back to top |
|
 |
Filos
Joined: 14 Dec 2009 Posts: 3
|
Posted: Wed May 12, 2010 3:08 pm Post subject: Re: Fail to establish the MySQL JDBC driver |
|
|
Hello
I had the same problem and it was resolved by deleting the row:
Class.forName( JDBC_DRIVER ). There is no need to load the jdbc driver for latest version of jdbc driver . It's enough to establish the connection to database and then create a statement.
I hope it was helpful!! |
|
| Back to top |
|
 |
Zelig
Joined: 04 Apr 2009 Posts: 64 Location: FRANCE
|
Posted: Wed May 12, 2010 9:19 pm Post subject: Re: Fail to establish the MySQL JDBC driver |
|
|
| Peter Pis wrote: | Hi,
have you added "MySQL JDBC Driver" library to the project? (Select the
project from "Projects" view and invoke "Properties" popup menu action,
switch to "Libraries" category -> "Compile" tab. By pushing "Add
Library" you can add that lib)
HTH,
-Peter
Zelig wrote:
| Quote: | Hello everybody,
My problem is related to the use of the Connector JDBC for My SQL. In Netbeans, the driver appears and I can connect to my databases.
When I try to connect from a Java application, the command "Class.forName("com.mysql.jdbc.Driver")" triggers, at runtime, the following error message :
"java.lang.ClassNotFoundException : com.mysql.jdbc.Driver". [Crying or Very sad]
Can someone please help me?
|
| Thanks Peter, your solution is efficient. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|