[英]Issue while retrieving data from the mySQL database in AIX system
I am trying to retrieve data from MySQL database table. 我正在尝试从MySQL数据库表检索数据。 To do that, I use following code on various platforms.
为此,我在各种平台上使用以下代码。 My code works perfectly on Windows and Linux platforms.
我的代码可以在Windows和Linux平台上完美运行。 But when I use same code in AIX 6.1, it does not retrieve correct data.
但是,当我在AIX 6.1中使用相同的代码时,它不会检索正确的数据。
The Main Function: 主要功能:
String storedstring = objDBUtil.lookup(0);
logger.info(storedstring);
The Database Util Function: 数据库使用功能:
public String lookup(String number) throws Exception {
String sql = "SELECT info FROM records WHERE Snumber=?";
Connection dbConn = connect();
try {
PreparedStatement stmt = dbConn.prepareStatement(sql);
try {
stmt.setString(1, number);
ResultSet rs = stmt.executeQuery();
try {
if (!rs.next()) {
throw new TException("does not exist in the database");
}
return rs.getString(1);
} catch (Exception e) {
logger.info("Unexpected exception caught during auth: " + e.getClass().toString() + " " + e.getMessage());
return null;
}finally {
rs.close();
}
} finally {
stmt.close();
}
} finally {
dbConn.close();
}
}
Output of the main function on Windows, I get the entire string from the database. 在Windows上main函数的输出中,我从数据库中获取了整个字符串。 But exact code gives me encrypted value on AIX machine.
但是确切的代码为我提供了在AIX机器上的加密值。
Output on AIX machine [B@62637268
在AIX机器上输出[B @ 62637268
I resolved the issue. 我解决了这个问题。 Issue was with connector file.
问题与连接器文件有关。 I was using older version of connector file.
我正在使用旧版本的连接器文件。
MySQL version I was using: mysql-5.5.2-m2-aix5.3-powerpc-64bit 我正在使用的MySQL版本:mysql-5.5.2-m2-aix5.3-powerpc-64bit
Non working version of Mysql connector with above mysql: mysql-connector-java-3.1.7-bin.jar 具有以上mysql的Mysql连接器的非工作版本:mysql-connector-java-3.1.7-bin.jar
Working version of MySQL connctor with above mysql: New version: mysql-connector-java-5.1.6-bin.jar 具有以上mysql的MySQL连接器的工作版本:新版本:mysql-connector-java-5.1.6-bin.jar
Thank you everyone for looking into my question and trying to help me. 谢谢大家调查我的问题并为我提供帮助。 Really appreciated.
非常感谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.