本文介绍了netbeans with glassfish没有找到适用于mysql的合适的驱动程序:jdbc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我是java中的noob ee 但是为了学习它,我应该连接到mysql! 我已经搜索了一天: Class.forName(com.mysql.jdbc.Driver)。newInstance(); 连接连接= DriverManager.getConnection(mysql:jdbc://127.0.0.1:3036 / shedule,root,12345); 表示: java .sql.SQLException:找不到适合于mysql的驱动程序:jdbc://127.0.0.1:3036 / shedule 0)mysql -h 127.0.0.1 -P 3306 -u root -p works 2)netstat表示mysqld监听到0.0.0.0:3306 4)我只有mysql-connector-java-5.1.6-bin.jar没有其他jar ! 它位于: D:\程序文件\NetBeans 6.9\\\\\\模块\\ ext和 D:\NetBeansProjects\MyProject\build\web\WEB-INF\lib 5)我选择了添加库和mysql-connector-java-5.1.6-bin.jar 6)人们说NetBeans将这个jar部署到 D:\ Program Files \glassfish-3.0.1\glassfish\domains\domain1\lib 但部署后没有mysql-connector-java-5.1.6-bin.jar 7)我已将此连接器的源代码(5.1.14)解压到我的src / java文件夹中 添加库ant-contrib.jar c3p0-0.9.1-pre6.jar和jboss-common-jdbc-wrapper.jar 我的项目会建立并部署规范,但可以处理此异常! Finaly: 解决方案该错误意味着您的网址不正确。 mysql:jdbc://127.0.0.1:3036 / shedule 应该是这样的: $ j $ b $ j $' 和mysql都倒退了。而且,如前所述,默认端口是不正确的。 您必须将所有您尝试解决此问题的疯狂内容都撤消。您应该将MySQL连接器JAR放在一个地方,如果它是共享的,或者位于应用程序的WEB-INF / lib中,则为您的应用服务器的/ lib目录。没有别的地方。 I am a noob in java eeBut to learn it I should connect to mysql!I have googled about a day:Class.forName("com.mysql.jdbc.Driver").newInstance();Connection connection = DriverManager.getConnection("mysql:jdbc://127.0.0.1:3036/shedule", "root", "12345");said:java.sql.SQLException: No suitable driver found for mysql:jdbc://127.0.0.1:3036/shedule0) mysql -h 127.0.0.1 -P 3306 -u root -p works2) netstat said that mysqld listened to 0.0.0.0:33063) lastest netbeans 6.9.1 + glassfish 3.0.14) I have ONLY mysql-connector-java-5.1.6-bin.jar no other jars! searched at all hard drives before and after deploy!it seat at:D:\Program Files\NetBeans 6.9\ide\modules\ext andD:\NetBeansProjects\MyProject\build\web\WEB-INF\lib5) I have selected "add Library" and mysql-connector-java-5.1.6-bin.jar6) people said that netbeans deploy this jar toD:\Program Files\glassfish-3.0.1\glassfish\domains\domain1\libBut after deploy there are no mysql-connector-java-5.1.6-bin.jar7) I have unpacked source of this connector (5.1.14) to my src/java folderadded libraries ant-contrib.jar c3p0-0.9.1-pre6.jar and jboss-common-jdbc-wrapper.jarMy project builds and deploys normaly but work with this exception!Finaly: 解决方案 That error means your URL is incorrect. That's what that exception usually means."mysql:jdbc://127.0.0.1:3036/shedule"should be this: "jdbc:mysql://127.0.0.1:3306/shedule"The "jdbc" and "mysql" are backwards. And, as noted earlier, the default port is incorrect.You'll have to reverse all that crazy stuff you tried to fix this. You should have the MySQL connector JAR in one place, either a /lib directory for your app server if it's shared or in WEB-INF/lib of your application. Nowhere else. 这篇关于netbeans with glassfish没有找到适用于mysql的合适的驱动程序:jdbc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-13 11:41