搞了好久,cai
一是:连接URL格式出现了问题(Connection conn=DriverManager.getConnection ("jdbc:mysql://localhost:3306/XX","root","XXXX")
二是:驱动字符串出错(com.mysql.jdbc.Driver)
三是Classpath中没有加入合适的mysql_jdbc驱动
经过我的仔细检查,这三种错误我都没有犯,为什么呢?
尝试着将mysql-connector-java-5.1.6-bin.jar的jar包加入E:\Program Files\Java\jdk1.6.0_20\jre\lib\ext文件夹下,问题解决了!!
原来是不仅仅要求将驱动加入classpath中,而且需要将该jar包加入到java运行环境的外部jar包中。
不仅仅需要在build path中加入connector的jar包,还需要在文件夹E:\Java Compiling\.metadata\.me_tcat7\webapps\chap0301\WEB-INF\lib里面拷贝一个connector的jar包,才能连接数据可成功
<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="ISO-8859-1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <% Connection con; Statement sql; ResultSet rs; try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { out.print(e); } try { String uri = "jdbc:mysql://localhost:3306/jsp"; con = DriverManager.getConnection(uri, "root", "12"); out.println("Hello"); out.print("</table>"); con.close(); } catch (SQLException e1) { out.print(e1); } %> </body> </html>
相关推荐
包括 ImpalaJDBC3 ImpalaJDBC4 ImpalaJDBC41 三个版本的ImpalaJDBC连接所需Jar
服务器出现java.sql.SQLException No suitable driver found for 的
"No suitable driver found for jdbc:derby://localhost:1527/Employees" 解决上面问题,连接java和数据库会用到的包。
thumbnailator-0.4.8压缩包 0.4.8版
mysql5.6连接驱动jaf,可处理报错java.sql.SQLException: No suitable driver
Third-party database drivers for Sybase, SQL Server and MySQL. For more information on setting up the third-party drivers, see Migrations: Getting Started Version control systems, Concurrent Versions...
下面小编就为大家带来一篇完美解决ntp的错误问题no server suitable for synchronization fo。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
功能强大的图片压缩工具类。支持比例缩放,指定大小进行缩放,旋转,水印,裁剪,转化图像格式等。
Proxool连接池使用方法 首先, 你要把下载 proxool 的 lib 下面所有的 jar 文件, 放到 WEB-INF/lib 下面, 另外, 把你的 jdbc driver 也放到相同的 lib,
介绍在Linux下搭建“虚拟机+优麒麟+QT5”的C++开发环境的方法。 提供了QT5的“No valid kits found”错误解决方法。
No suitable java found.In order to properly use the android developer tools...-附件资源
Xcode10 处理 no suitable image found. Did find: /usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator 相关问题文件包
一老哥想要实现navicat远程centos7上mongodb数据库 但是,不知咋的,就是远程不了,下面贴截图 navicat远程报错信息如下图 排查了一会 有发现: 一个问题就是:mongodb.conf 配置文件 配置把 binip 给注释掉 ...
AX6800x family is suitable for Desktop/Cable/Enterprise/Cat 5 USB KVM switches, USB Cat 5/Fiber Optic/HDBaseT 1.0 KVM extenders, Android USB-C Gaming Phone Dock, USB Roaming Mouse KM Switch, USB KM ...
ceph源码编译时出现下列现象时,需要下载这两个rpm包: checking for NSS... no configure: error: in `/root/workspace/...configure: error: no suitable crypto library found See `config.log' for more details
Hello all, MySQL Connector/J 5.1.26, a maintenance release of the ...JDBC driver for MySQL. Version 5.1.26 is suitable for use with many MySQL server versions, including 4.1, 5.0, 5.1, 5.4, 5.5 and 5.6.
ImageReader