public Connection getConn()
{
Connection cpsConnection=null;
if (cpsConnection == null)
{
try {
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
cpsConnection = DriverManager.getConnection (ServerConfig.db_connect_string,ServerConfig.db_user_string,ServerConfig.db_pwd_string);
} catch(Exception e){e.printStackTrace();}
}
return cpsConnection;
} public Connection getConn1()
{
Connection cpsConnection=null;
try {
if (cpsConnection == null)
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
cpsConnection = java.sql.DriverManager.getConnection(ServerConfig.mysql_connect_string,ServerConfig.mysql_user_string,ServerConfig.mysql_pwd_string);
} } catch(Exception e) {e.printStackTrace();}
return cpsConnection; }上面是我连接数据库的代码,第一个是oracle,第二个是mysql。
客户端是xp+sp2,服务器是2003,oracle9i,mysql4.1.1.13-nt。一开始的时候一切正常,都是1秒左右就完成了。但是前几天发现2个函数的.getConnection 方法都很慢,mysql的需要17秒,oracle的更需要将近30秒。但是连接我本地机的mysql就很快。
我尝试了重装客户端的jdk1.5,还有就是关掉客户端的防火墙,仍然没有改善。
把程序在其他客户端运行则非常正常,基本在1秒左右完成。请问哪位遇到过这样的情况?在线等待帮助。
{
Connection cpsConnection=null;
if (cpsConnection == null)
{
try {
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
cpsConnection = DriverManager.getConnection (ServerConfig.db_connect_string,ServerConfig.db_user_string,ServerConfig.db_pwd_string);
} catch(Exception e){e.printStackTrace();}
}
return cpsConnection;
} public Connection getConn1()
{
Connection cpsConnection=null;
try {
if (cpsConnection == null)
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
cpsConnection = java.sql.DriverManager.getConnection(ServerConfig.mysql_connect_string,ServerConfig.mysql_user_string,ServerConfig.mysql_pwd_string);
} } catch(Exception e) {e.printStackTrace();}
return cpsConnection; }上面是我连接数据库的代码,第一个是oracle,第二个是mysql。
客户端是xp+sp2,服务器是2003,oracle9i,mysql4.1.1.13-nt。一开始的时候一切正常,都是1秒左右就完成了。但是前几天发现2个函数的.getConnection 方法都很慢,mysql的需要17秒,oracle的更需要将近30秒。但是连接我本地机的mysql就很快。
我尝试了重装客户端的jdk1.5,还有就是关掉客户端的防火墙,仍然没有改善。
把程序在其他客户端运行则非常正常,基本在1秒左右完成。请问哪位遇到过这样的情况?在线等待帮助。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货