当前位置:web 服务器 > Tomcat >>

mysql数据库连接问题 开发环境myeclipse tomcat

第21行出错 Type mismatch: cannot convert from java.sql.Statement to com.mysql.jdbc.Statement 咋回事?之前几个例子也没这样啊 package mybean; import java.sql.* ; import com.mysql.jdbc.Statement; public class AlertPersonInfo { public Connection getConnection(){ try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); String url ="jdbc:mysql://localhost/project" ; Connection conn = DriverManager.getConnection(url , "root" , "root") ; return conn ; }catch(Exception e){ System.out.print("数据库连接出错:"+ e); return null; } } public ResultSet updatePersonInfo(String na,String se,String ag,String sc,String ac,String te){ try{ String sql="update person_info set name='"+na+"',sex='"+se+"',age='"+ag+"',school='"+sc+"',academy='"+ac+"',tel='"+te+"'"; /* 第21行 */ Statement stmt=getConnection().createStatement(); ResultSet rs=stmt.executeQuery(sql) ; return rs; }catch(Exception e){ System.out.print("mybean.AlertPersonInfo.updatePersonInfo()出现错误:"+ e); return null; } } }
Apache
IIS
Nginx
Tomcat
如果你遇到web 服务器难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,