当前位置: 技术问答>java相关
急!求教连接MySQL的问题
来源: 互联网 发布时间:2015-09-01
本文导语: set classpath=C:j2sdk1.4,C:j2sdkee1.3libejb10deployment.jar,C:j2sdkee1.3libj2ee.jar,C:j2sdkee1.3libjhall.jar,C:jdbcmm.mysql.jdbc-1.2cmysql_comp.jar set java_tomcat=c:jakarata-tomcatjakarta-tomcat set j2ee_home=c:j2sdkee1.3 set java_home=C:j2sdk1.4 这是我配置的环境,编译...
set classpath=C:j2sdk1.4,C:j2sdkee1.3libejb10deployment.jar,C:j2sdkee1.3libj2ee.jar,C:j2sdkee1.3libjhall.jar,C:jdbcmm.mysql.jdbc-1.2cmysql_comp.jar
set java_tomcat=c:jakarata-tomcatjakarta-tomcat
set j2ee_home=c:j2sdkee1.3
set java_home=C:j2sdk1.4
这是我配置的环境,编译不能加载MySQL的驱动,请各位高手赶快帮忙
set java_tomcat=c:jakarata-tomcatjakarta-tomcat
set j2ee_home=c:j2sdkee1.3
set java_home=C:j2sdk1.4
这是我配置的环境,编译不能加载MySQL的驱动,请各位高手赶快帮忙
|
private String dburl = "jdbc:mysql://localhost/ipcharge?user=root";
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection Conn = DriverManager.getConnection(dburl);
Statement Stmt = Conn.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT * from ip_custom");
}catch (Exception E) {
JOptionPane.showMessageDialog(null, "不能载入MSql驱动程序!", "警告", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection Conn = DriverManager.getConnection(dburl);
Statement Stmt = Conn.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT * from ip_custom");
}catch (Exception E) {
JOptionPane.showMessageDialog(null, "不能载入MSql驱动程序!", "警告", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}