请教MYSQL的数据库连接问题?先谢了 怎么没有人帮我呀?对了,我的tomcat和jdk装在c盘,mysql装在D盘,mysql jdbc驱动放在了d:mysql下,并已在classpath中增加了D:\mysql\mm.mysql204bin.jar 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问“mm.mysql204bin.jar”哪里下载呀? Class.forName("org.gjt.mm.mysql.Driver").newInstance(); String url ="jdbc:mysql://localhost/mysql?user=dszch&password=1225& useUnicode=true&characterEncoding=8859_1" //testDB为所连接的数据库名 Connection conn= DriverManager.getConnection(url); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); 这些语句会抛出异常(Exception)你需要用 try{Class.forName("org.gjt.mm.mysql.Driver").newInstance(); String url ="jdbc:mysql://localhost/mysql?user=dszch&password=1225& useUnicode=true&characterEncoding=8859_1" //testDB为所连接的数据库名 Connection conn= DriverManager.getConnection(url); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); }catch(Exception e){} 你换个版本的myysql试试呢? 基本上是因为jdbc驱动程序找不到造成的,也又可能是jdbc驱动版本不符合!把jar文件放在tomcat/common/lib下面试试看,如果是版本问题,那就下载适合的版本就好了 String url ="jdbc:mysql://localhost/mysql?user=dszch&password=1225& useUnicode=true&characterEncoding=8859_1" String sql="select * from test"; mysql数据库里面没有test表吧?你的代码应该报了异常的,看看错误日志 mysql数据库里面没有test表?错误的日志在那看呀?我如何再加一个test表呀?谢谢楼上各位。mm.mysql204bin.jar的下载,我是用天网搜的。可以用mm.mysql去搜,很多FTP都有。 这几天这个问题已经连续发了几个帖,说得方法都不行,都没人能解决吗???? (Math.floor(Math.random()*3)==0))是什么? 请问struts1与struts2整合时的问题 hibernate 一对多双向关联问题 struts中通过过滤器发现的两个问题 一个<html:options>标签问题 ===怎么让tomcat 怎么不写日志???=== 怎样将动态页面转成静态的 菜鸟在线请教JSP运行问题 jsp为什么不能运行了???? 我是一个初学者,找不到这个错误的地方,请大家帮忙看看 为.JSP文件配置的web.xml文件问题
String url ="jdbc:mysql://localhost/mysql?user=dszch&password=1225&
useUnicode=true&characterEncoding=8859_1"
//testDB为所连接的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); 这些语句会抛出异常(Exception)你需要用 try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/mysql?user=dszch&password=1225&
useUnicode=true&characterEncoding=8859_1"
//testDB为所连接的数据库名
Connection conn= DriverManager.getConnection(url);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}catch(Exception e){
}
把jar文件放在tomcat/common/lib下面试试看,如果是版本问题,那就下载适合的版本就好了
useUnicode=true&characterEncoding=8859_1"
String sql="select * from test";
mysql数据库里面没有test表吧?
你的代码应该报了异常的,看看错误日志
谢谢楼上各位。mm.mysql204bin.jar的下载,我是用天网搜的。可以用mm.mysql去搜,很多FTP都有。