SQL Server Attention

本文探讨了使用微软提供的MSSQLServerJDBC驱动时遇到的兼容性问题,特别是当查询包含image或text类型字段时,必须按照顺序读取数据,否则会引发错误。为解决此问题,建议更换第三方驱动。

ResultSet can not re-read row data for column- -

今天在写程序的时候发现了一个很奇怪的问题“ResultSet can not re-read row data for column”,用google一搜,原来是微软公司的驱动的兼容性不太好。有热心人总结了微软驱动的缺点:(1)如果采用jdbc-odbc驱动,那么就必须按照查询顺序来一次读取(不论有没有image或text类型)
(2)如果采用微软提供的ms sql server jdbc driver,如果查询语句中,不存在image或text类型字段,那么可以按照无序获取
(3)如果采用微软提供的ms sql server jdbc driver,如果查询语句中,存在image或text类型字段,那么就必须按照顺序读取,否则就会报告Driver]ResultSet can not re-read row data for column之类的错误
(4)如果想不查询语句中有没有image或text类型字段,都可以不按照顺序获取,或重复获取。那么就必须更换驱动,改用第三方的。
 

这里很容易出错。大家要多多注意~

我也会把这个问题记牢的~~吃一堑长一智

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10395457/viewspace-982580/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10395457/viewspace-982580/

### SQL Server Numeric to Int Conversion Method and Considerations In SQL Server, converting from `numeric` or `decimal` types to an integer (`int`) type involves understanding both data precision and potential loss of information. The conversion can be performed using explicit casting with functions like `CAST()` or `CONVERT()`. However, attention must be paid to the scale and range limitations when transitioning between these two distinct numerical representations. When performing such conversions, any fractional part will be truncated rather than rounded towards zero[^1]. For example: ```sql SELECT CAST(123.45 AS INT) -- Result: 123 ``` The valid range for integers in SQL Server spans from `-2^31 (-2,147,483,648)` through `2^31 - 1 (2,147,483,647)`[^4], which means values outside this interval cannot directly convert without causing overflow errors unless they are first adjusted into bounds via other operations prior to casting. To handle cases where there might exist numbers beyond what fits within standard int limits during transformation processes, one approach could involve checking against boundary conditions before applying casts; alternatively, consider utilizing larger storage formats like bigint if necessary depending upon application requirements. For scenarios involving very large datasets or complex transformations including multiple steps across different systems—such as moving data between Oracle databases mentioned elsewhere but not specifically here—it may also prove beneficial to explore additional tools provided by specific database management platforms designed explicitly around handling intricate schema mappings efficiently while preserving integrity throughout migrations[^3]. --related questions-- 1. What methods does Oracle provide for similar type conversions? 2. How do you manage overflow risks effectively when changing numeric scales? 3. Can you explain how decimal places affect performance after conversion to integer types? 4. In what situations would it make sense to use BIGINT over INT post-conversion?
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值