mmmysql驱动程序连接数据库不成功,郁闷,帮帮忙 我改成jdbc:mysql://localhost//test也是不行test是我建立的一个数据库 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 借问一句,你是在什么环境中执行的?另外,你可以在catch中使用e.printStackTrace()看是Driver Class没有加载还是URL错误,然后再下结论。 try{ String DBUser=" "; String DBPassword=" "; String DBServer=" "; String DBName=" "; Class.forName("org.gjt.mm.mysql.Driver").newInstance(); con=java.sql.DriverManager.getConnection("jdbc:mysql://"+DBServer+":3306/"+DBName+"?useUnicode=true&characterEncoding=gb2312", DBUser,DBPassword); }catch(ClassNotFoundException cnfe) { error="class no found exception "; throw new ClassNotFoundException(error); }catch(SQLException sqle) { error=" sql error in connection "; throw new SQLException(error); }catch(Exception e) { error="unknow exception in connection"; throw new Exception(error); } 有人对接过当当APi 接口没?求救! 就是查找在其中的个数 hssfworkbook可以向生成的excel中的时候,在程序的的后台定义excel的函数吗? 有研究过nutch合并索引的高手进来 dwr 调用返回javaBean参数函数 显示undefined 请大家帮助,十万火急!!!!! 正则表达式提取html串的问题 关于使用foreach和itrator是遇到了问题 大家是下载那个Struts 1.2.4? 我为什么不能创建AccesseBean,在线等待! CORBA传递的是对象还是引用?RMI呢?J2EE呢? JDOM 如何操作 XML
String DBUser=" ";
String DBPassword=" ";
String DBServer=" ";
String DBName=" ";
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
con=java.sql.DriverManager.getConnection("jdbc:mysql://"+DBServer+":3306/"+DBName+"?useUnicode=true&characterEncoding=gb2312", DBUser,DBPassword);
}catch(ClassNotFoundException cnfe)
{
error="class no found exception ";
throw new ClassNotFoundException(error);
}catch(SQLException sqle)
{
error=" sql error in connection ";
throw new SQLException(error);
}catch(Exception e)
{
error="unknow exception in connection";
throw new Exception(error);
}