This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
This problems doesn't happen in the case of using the Netbeans Derby Database. First, create a new Java Project, use the persistence wizard to create the entity beans and the persistence.xml. I am using in my test MySQL database. I added the latest Drivers for the MySQL DB to the project. I run a test in the Java Project for persisting Data and Reading Data, all goes fine with no problem at all. I create a new Web Project with the Visual Web Pack. I add the Persistence project created before to my new web project. I mount a dao, accessing the list of Data from the persistence store, and a Data Provider that I add to the SessionBean. I create a table bounded to my Data Provider, and a button to load the data to the table. I initialize the table to empty object and create a method "RefreshList" called by the Load button created in the visual editor, that will load the List of Data to the Table. I am having te following error: Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/netcat Error Code: 0 Although, the MySQL Driver was already added to the project...
Do you deploy the driver with the project, i.e. is the 'package' checkbox checked in the project libraries?
Yes it is checked, hence the driver is being deployed with the project
I'm reassigning to web/project for further evaluation, the problem is that the libraries added to the Java project are not being deployed with the Web project. Not sure what is the correct behaviour.
> Not sure what is the correct behaviour. Same for me. Any ideas Petr?
I'm not now sure, the Internal Exception you obtain during design time or in runtime?
Hi Ptr, it is occurring on runtime only.
I have no idea why you obtain the exception. What is the target server?
The exception is thrown since the MySQL driver is not being deployed with the project and the server doesn't have it either. The problem is that even though the driver library is added to the Java project, which in turn is added to the Web project, it is not getting deployed with the Web project.
Racx, if you didn't attach the driver directly with the web project, try it.
The target server is glassfish v2 bundled with netbeans. I am attaching the driver through the IDE and not manually. When I deploy the project, no exception occur, since no direct access to the drivers is being used. On runtime the error occur when TopLink is trying to access the database through the MySQL Driver. One peculiar thing to notice, is that whenever I use the Apache Derby this excpetion is not thrown. If needed, I can Zip the project and send for you, but it is just a simple application that I mount for testing the IDE's wizard functionalities.
Just marking the issue as NetCat Thanks
GlassFish bundles the Derby driver, so that's why it works with Derby. You should be able to make this work by adding the MySQL driver directly to the Web project (using the IDE) instead of adding it just the Java project. We still need to look into why the driver is not deployed to the server when it is added just to the Java project.
Ok, now I think I covered all the possibilities(4 of them) and it seems the driver is really not being deployed: 1- I added the driver to the Java Project only. I left the Web Project without the MySQL Driver. Result: Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/netcat 2- I added the driver to both the Java Project AND to the Web Project. Result: the same... 3- I added the driver ONLY to the web Project, I removed ot from the Java Project. Result: Same error too! 4- I added manually the MySQL Driver to the Glassfish environment (Not from the IDE). Result: It worked!!!! Now, I'm sure that the IDE is not deploying the driver with the project.
So I have been investigating a little bit and the result is: Scenarios nr. 2 and 3 work for me - jdbc-mysql.jar is in '*.war/WEB-INF/lib' folder so the application is deployed without any problem. Scenario 1: We are not sure how it should behave but probably the best behaviour would be to add project *and all its dependencies* to the libraries (the libraries node) of the project. Then one could easily remove all the useless libraries (this case is needed e.g. when application server already has its own libraries). So I suggest to change this issue to enhancement for implementing such changes mentioned for scenario nr. 1. Unfortunately it's out-of-scope for NetBeans 6.0. Thank you for reporting. Product Version: NetBeans IDE Dev (Build 071001) Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05 System: Linux version 2.6.22-gentoo-r8 running on i386; ANSI_X3.4-1968; en_US (nb) GlassFish V2 FCS
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss
(In reply to Martin Balin from comment #15) > This old bug may not be relevant anymore. If you can still reproduce it in > 8.2 development builds please reopen this issue. > > Thanks for your cooperation, > NetBeans IDE 8.2 Release Boss Using: ====== GlassFish Server v4.1 Netbeans 8.2 Windows 8 JDK 8 I added MySQL as a JDBC resource and Pool, but when trying to use an app that makes use of JDBC I get: "java.sql.SQLException: No suitable driver found for jdbc:mysql://xxx.xxx.xxx.xxx:3306/mededi" I even recreated the pool and resource using asadmin, to no avail. Exception persisted after making the change and restarting the server.