[英]Java connect to OracleDB very slowly (with ojdbc6.jar and Linux)
I'm try to deploy the web services that have a connection to ORACLE database (10g). 我正在尝试部署与ORACLE数据库(10g)有连接的Web服务。
Currently, I have - CentOS 6.4 64bits - Apache Tomcat 7.0.42 with JDK 1.7.0_25 - Ojdbc6.jar 当前,我拥有-CentOS 6.4 64位-具有JDK 1.7.0_25的Apache Tomcat 7.0.42-Ojdbc6.jar
When I calling web services with the same version of tomcat on Windows. 在Windows上使用相同版本的tomcat调用Web服务时。 It's working properly (0.1-0.5 Seconds/transaction).
它工作正常(0.1-0.5秒/事务)。
but unfortunately, when I try to call it on CentOS server, It quite very slow (10-20 seconds/transaction) 但是不幸的是,当我尝试在CentOS服务器上调用它时,它非常慢(每事务10-20秒)
The libraries are exactly same except the OS and as I monitoring catalina.out, there is no error but It's slowly when dbCreateConnection() was executed) 这些库是完全相同的,除了操作系统以及我监视catalina.out时,没有错误,但是执行dbCreateConnection()时很慢)
Please give me an advise. 请给我一个建议。
Thanks :\\ 谢谢 :\\
FYI, Here is the code in database section. 仅供参考,这是数据库部分中的代码。
try {
Class.forName("oracle.jdbc.OracleDriver");
InputStream isr = this.getClass().getResourceAsStream("/"+"dbConfig.properties");
Properties prop = new Properties();
if (isr != null){
InputStreamReader isrProperties = new InputStreamReader(isr);
prop.load(isrProperties);
}
String dbURL = "jdbc:oracle:thin:@"+prop.getProperty("dbhost")+":"+prop.getProperty("dbport")+":"+prop.getProperty("dbname");
System.out.println("TRACE : getdbConfig --> "+dbURL);
String username = prop.getProperty("dbuser");
String password = prop.getProperty("dbpass");
dbConn = DriverManager.getConnection(dbURL, username, password);
if(dbConn != null){
System.out.println("TRACE : Connected to "+dbURL);
}
}
catch (SQLException ex) {
System.out.println("Error Message : getConnection Failed --> "+ex.getSQLState());
ex.printStackTrace();
}
使用JVM标志启动Java:
-Djava.security.egd=file:/dev/./urandom
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.