当前位置: 技术问答>java相关
Connection类的问题
来源: 互联网 发布时间:2015-01-03
本文导语: Connection.preparedStatement(sql, type, concur); 当type = ResultSet.TYPE_FORWARD_ONLY时, ResultSet.getString()返回值为正常的汉字,设type = ResultSet.TYPE_SCROLL_SENSITIVE或TYPE_SCROLL_INSENSITIVE时,返回值为0x3a4fe32c4391。 请教如何解决。谢了先...
Connection.preparedStatement(sql, type, concur);
当type = ResultSet.TYPE_FORWARD_ONLY时, ResultSet.getString()返回值为正常的汉字,设type = ResultSet.TYPE_SCROLL_SENSITIVE或TYPE_SCROLL_INSENSITIVE时,返回值为0x3a4fe32c4391。
请教如何解决。谢了先!
当type = ResultSet.TYPE_FORWARD_ONLY时, ResultSet.getString()返回值为正常的汉字,设type = ResultSet.TYPE_SCROLL_SENSITIVE或TYPE_SCROLL_INSENSITIVE时,返回值为0x3a4fe32c4391。
请教如何解决。谢了先!
|
I didn't find the problem you said.
This is the test application:
package beans;
import java.sql.*;
import java.math.*;
public class TestConn {
public static void main(String[] args) {
try {
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@192.168.0.15:1521:ec",
"intranet", "intranet");
// Statement stmt = conn.createStatement();
// Statement stmt = conn.createStatement(
// ResultSet.TYPE_SCROLL_INSENSITIVE,
// ResultSet.CONCUR_UPDATABLE);
// ResultSet rs = stmt.executeQuery("select subject from jivemessage");
PreparedStatement pstmt = conn.prepareStatement("select subject from jivemessage",
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String subject = rs.getString(1);
System.out.println(subject);
}
}
catch (SQLException se) {
}
}
}
This is the test application:
package beans;
import java.sql.*;
import java.math.*;
public class TestConn {
public static void main(String[] args) {
try {
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@192.168.0.15:1521:ec",
"intranet", "intranet");
// Statement stmt = conn.createStatement();
// Statement stmt = conn.createStatement(
// ResultSet.TYPE_SCROLL_INSENSITIVE,
// ResultSet.CONCUR_UPDATABLE);
// ResultSet rs = stmt.executeQuery("select subject from jivemessage");
PreparedStatement pstmt = conn.prepareStatement("select subject from jivemessage",
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
String subject = rs.getString(1);
System.out.println(subject);
}
}
catch (SQLException se) {
}
}
}
|
我也没发现
|
可能要设置一下系统编码为gb2312吧