TYPE_SCROLL_SENSITIVE to TYPE_SCROLL_INSENSITIVE

简介: TYPE_SCROLL_SENSITIVE to TYPE_SCROLL_INSENSITIVE

相关开发要求和限制 参考:https://docs.oracle.com/database/121/JJDBC/resltset.htm#JJDBC28629:

17 Result Set

Resultset Limitations and Downgrade Rules

ome types of result sets are not feasible for certain kinds of queries. If you specify an unfeasible result set type or concurrency type for the query you run, then the JDBC driver follows a set of rules to determine the best feasible types to use instead.

The actual result set type and concurrency type are determined when the statement is run, with the driver issuing a SQLWarning on the statement object if the desired result set type or concurrency type is not feasible. The SQLWarning object will contain the reason why the requested type was not feasible. Check for warnings to verify whether you received the type of result set that you requested.

Result Set Limitations

The following limitations are placed on queries for enhanced result sets. Failure to follow these guidelines results in the JDBC driver choosing an alternative result set type or concurrency type.

To produce an updatable result set:

A query can select from only a single table and cannot contain any join operations.

In addition, for inserts to be feasible, the query must select all non-nullable columns and all columns that do not have a default value.

A query cannot use SELECT * .

However, there is a workaround for this.

A query must select table columns only.

It cannot select derived columns or aggregates, such as the SUM or MAX of a set of columns.

To produce a scroll-sensitive result set:

A query cannot use SELECT * .

However, there is a workaround for this.

A query can select from only a single table.

Scrollable and updatable result sets cannot have any column as Stream. When the server has to fetch a Stream column, it reduces the fetch size to one and blocks all columns following the Stream column until the Stream column is read. As a result, columns cannot be fetched in bulk and scrolled through.

Workaround

As a workaround for the SELECT * limitation, you can use table aliases, as shown in the following example:

SELECT t.* FROM TABLE t ...
Note:

There is a simple way to determine if your query will probably produce a scroll-sensitive or updatable result set: If you can legally add a ROWID column to the query list, then the query is probably suitable for either a scroll-sensitive or an updatable result set.
Result Set Downgrade Rules

If the specified result set type or concurrency type is not feasible, then Oracle JDBC driver uses the following rules in choosing alternate types:

If the specified result set type is TYPE_SCROLL_SENSITIVE, but the JDBC driver cannot fulfill that request, then the driver attempts a downgrade to TYPE_SCROLL_INSENSITIVE.

If the specified or downgraded result set type is TYPE_SCROLL_INSENSITIVE, but the JDBC driver cannot fulfill that request, then the driver attempts a downgrade to TYPE_FORWARD_ONLY.

If the specified concurrency type is CONCUR_UPDATABLE, but the JDBC driver cannot fulfill that request, then the JDBC driver attempts a downgrade to CONCUR_READ_ONLY.

Note:

Any manipulations of the result set type and concurrency type by the JDBC driver are independent of each other.
Verifying Result Set Type and Concurrency Type

After a query has been run, you can verify the result set type and concurrency type that the JDBC driver actually used, by calling methods on the result set object.

int getType() throws SQLException

This method returns an int value for the result set type used for the query. ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE are the possible values.

int getConcurrency() throws SQLException

This method returns an int value for the concurrency type used for the query. ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE are the possible values.

Avoiding Update Conflicts
It is important to be aware of the following facts regarding updatable result sets with the JDBC drivers:

The drivers do not enforce write locks for an updatable result set.

The drivers do not check for conflicts with a result set DELETE or UPDATE operation.

A conflict will occur if you try to perform a DELETE or UPDATE operation on a row updated by another committed transaction.

Oracle JDBC drivers use the ROWID to uniquely identify a row in a database table. As long as the ROWID is valid when a driver tries to send an UPDATE or DELETE operation to the database, the operation will be run.

The driver will not report any changes made by another committed transaction. Any conflicts are silently ignored and your changes will overwrite the previous changes.

To avoid such conflicts, use the Oracle FOR UPDATE feature when running the query that produces the result set. This will avoid conflicts, but will also prevent simultaneous access to the data. Only a single write lock can be held concurrently on a data item.

相关文章
|
12月前
|
JSON 应用服务中间件 nginx
采集 Nginx 日志的几种方式
本文系统介绍采集Nginx日志的六种主流方式:本地文件读取、Agent采集(如Filebeat)、Syslog转发、Sidecar模式、JSON格式化输出及云服务集成。涵盖单机到云原生场景,助你构建高效、可扩展的日志体系,提升监控与故障排查能力。(238字)
809 152
|
SQL 存储 监控
SLS 物化视图来了:大规模日志查询提速 100 倍,资源消耗直降 90%
阿里云日志服务推出物化视图,通过智能预计算 + 自动查询改写,实现监控看板秒级响应、资源开销大幅降低,彻底解决‘查得慢、扛不住、不准’三大难题。
738 83
|
人工智能 自然语言处理 数据库
超越传统搜索:RAG如何让AI更懂你
超越传统搜索:RAG如何让AI更懂你
916 109
|
存储 移动开发 算法
ARM 常用汇编指令
下面是ARM架构中常用汇编指令的总结,涵盖数据处理、数据传输、分支跳转、堆栈操作等类别,方便你快速查阅和理解。
745 105
|
11月前
|
数据采集 安全 数据管理
2026年企业数据系统建设方案设计与实践指南
随着数据成为核心生产要素,新型企业数据系统已升级为全链路价值中枢。本文围绕技术、场景与合规三大维度,评估瓴羊Dataphin等主流方案,助力企业高效选型与落地,推动数字化转型。
|
11月前
|
人工智能 供应链 算法
人工智能专业求职竞争有多卷?靠精准提升,我拿到了3家大厂offer
AI求职竞争激烈,海投50+仅获2邀约。我通过精准定位岗位、双轨提升技术与业务能力、定制化简历与面试策略,最终斩获字节、阿里、小红书offer。经历让我明白:破局“内卷”关键不在盲目努力,而在精准匹配岗位需求,靶向提升实战能力。
|
12月前
|
人工智能 自然语言处理 供应链
AI领域必追的「技术+商业」双料导师:极睿科技武彬的硬核知识输出法则
武彬,清华计算机系本硕,极睿科技CEO,深耕AI+电商十余年。兼具技术实力与商业洞察,打造垂直大模型,服务4万+店铺、千家品牌,实现降本90%、GMV倍增。全平台粉丝480万,连续三年蝉联AI博主影响力冠军,以实战案例输出硬核知识,助力商家从内容到转化全面突破,树立“知行合一”行业标杆。(238字)
1043 0
|
存储 消息中间件 前端开发
PHP后端与uni-app前端协同的校园圈子系统:校园社交场景的跨端开发实践
校园圈子系统校园论坛小程序采用uni-app前端框架,支持多端运行,结合PHP后端(如ThinkPHP/Laravel),实现用户认证、社交关系管理、动态发布与实时聊天功能。前端通过组件化开发和uni.request与后端交互,后端提供RESTful API处理业务逻辑并存储数据于MySQL。同时引入Redis缓存热点数据,RabbitMQ处理异步任务,优化系统性能。核心功能包括JWT身份验证、好友系统、WebSocket实时聊天及活动管理,确保高效稳定的用户体验。
1093 4
PHP后端与uni-app前端协同的校园圈子系统:校园社交场景的跨端开发实践
|
SQL Oracle Java
__Oracle_JDBC_internal_ROWID__
__Oracle_JDBC_internal_ROWID__
501 3
|
缓存 NoSQL 数据库
Django缓存机制详解:从配置到实战应用
本文全面解析Django缓存技术,涵盖配置方法与六大缓存后端,结合实战场景演示四种典型应用方式,帮助开发者提升Web应用性能,应对高并发挑战。
574 0

热门文章

最新文章