« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9692658 建立时间:2004年12月20日 |

| |
[数据库]oracle8i数据库驱动TYPE_SCROLL_INSENSITIVE的bug 原创空间, 网上资源, 软件技术
邢红瑞 发表于 2005/4/20 10:02:29 |
这个问题很久以前也遇到过,东东也遇到了,oracle驱动的bug真多。Subject: prepareStatement return variance string value with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY
prepareStatement return variance string value with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY
When I use oracle jdbc driver whose version is 8.1.7.1.0,the PreparedStatement instance return different value of the same column 'yhry_checkfinter' which is defined in char(1).
Here is my application:
public static void main(String[] args) throws Exception { Class.forName("oracle.jdbc.OracleDriver"); Connection c = DriverManager.getConnection( "jdbc:oracle:thin:@10.1.7.177:1521:ora817", "user", "passt");
PreparedStatement ps = c.prepareStatement( "select yhry_checkfinter from yhyhry", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet res = ps.executeQuery(); System.err.println("DB:" + c.getMetaData().getDatabaseProductVersion()); System.err.println("Driver:" + c.getMetaData().getDriverVersion());
System.out.println("\nout with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY"); while (res.next()) { System.out.println("'" + res.getString("yhry_checkfinter") + "'"); }
ps = c.prepareStatement("select yhry_checkfinter from yhyhry"); res = ps.executeQuery(); System.out.println("\nout without TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY:"); while (res.next()) { System.out.println("'" + res.getString("yhry_checkfinter") + "'"); System.err.println("'" + res.getString(1) + "'"); }
c.close();
}
The following is the output on console:
DB:Oracle8i Release 8.1.7.4.1 - Production JServer Release 8.1.7.4.1 - Production Driver:8.1.7.1.0
out with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY 'Y ' 'Y ' 'Y ' 'Y ' 'Y ' 'Y ' 'N ' 'N ' 'Y ' 'Y ' 'N ' 'N ' 'N ' 'N '
out without TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY: 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'Y' 'N' 'N' 'N' 'N' 'Y' 'Y' 'Y' 'Y' 'N' 'N' 'N' 'N' 'N' 'N' 'N' 'N'
The value of yhry_checkfinter is always with two blank paddings ,when I execute the sql with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY,but it's type is char(1).
The value of yhry_checkfinter is correct,executing the sql without TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY.
Is this a bug of jdbc drive 8.1.7.1.0?If not,what happens.好在metalink的专家,给出了解答prepareStatement return variance string value with TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY
You're probably hitting Bug:1361738 - JDBC thin oracle.sql.CHAR may have too much blank padding with ScrollableResultSets
Symptoms: If the String returned by ScrollableResultSet.getString() is padded with extra blanks and you are using the thin driver, you have likely encountered this bug.
oracle.sql.CHAR values returned by ScrollableResultSets may be padded up to 3 times their correct length with blanks when using the thin driver.
The fix is available in Releases 8173,9010
|
|
|