spring-jdbc

ORA-01002: fetch out of sequence

天大地大妈咪最大 提交于 2020-01-15 12:09:32
问题 I am getting org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL UPDATE responses SET version_no = ( version_no + 1 ), read_status = 0, tslastmodified = SYSDATE WHERE responseid IN (SELECT responseid FROM responses WHERE read_status = 1 AND tslastmodified < SYSDATE - 45 / ( 24 * 60 ) AND id IN (SELECT id FROM emp)) ; SQL state [24000]; error code [1002]; ORA-01002: fetch out of sequence ; nested exception is java.sql.SQLException:

ORA-01002: fetch out of sequence

不打扰是莪最后的温柔 提交于 2020-01-15 12:09:18
问题 I am getting org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL UPDATE responses SET version_no = ( version_no + 1 ), read_status = 0, tslastmodified = SYSDATE WHERE responseid IN (SELECT responseid FROM responses WHERE read_status = 1 AND tslastmodified < SYSDATE - 45 / ( 24 * 60 ) AND id IN (SELECT id FROM emp)) ; SQL state [24000]; error code [1002]; ORA-01002: fetch out of sequence ; nested exception is java.sql.SQLException:

Spring JdbcTemplate batchUpdate handling exceptions

孤街浪徒 提交于 2020-01-14 14:35:31
问题 Currently our code uses batchUpdate method of JdbcTemplate to do batch Insertion. My question is in case of any exception in one of the update how to handle it (suppose just by adding the log) and continue with the next update sql statements? Also how batchUpdate() method fo JdbcTemplate handles the exceptions? Snippet here. /** * Saves the list of <code>Item</code> objects to the database in a batch mode * * @param objects * list of objects to save in a batch mode */ public void save(final

Oracle JDBC batchUpdate rows affected is always -2 (Statement.SUCCESS_NO_INFO)

只谈情不闲聊 提交于 2020-01-14 07:21:07
问题 I have a batch process which does Bulk UPDATE statement. After implementing batch support using Spring JDBC 4.1.6 and Oracle Jdbc Driver (ojdbc7 and ucp), the number of records affected for individual update requests (in the batch) are always retrieved as -2 (Statement.SUCCESS_NO_INFO). Is there any way to know the rows affected for individual update requests (argument set in batch), as I have to retry the same argument with an INSERT statement after this ?? Technically trying to develop this

Spring JDBC Template. How can get outcome variables of the pl/sql script

荒凉一梦 提交于 2020-01-14 04:01:06
问题 I am using NamedParameterJdbcTemplate for run pl/sql script. But I don't know how can I get the values ​​of out variables ( :id_out ). Thanks in advance. String script = "declare begin if myFunc(:id_in) is null then :id_out := 0; else :id_out := 1; end if; end;"; Map<String,Object> bindVars = new HashMap<String, Object>(); bindVars.put(id_in,1); bindVars.put(id_out,2); jdbcTmpl.execute(script, bindVars, new PreparedStatementCallback<Object>() { @Override public Object doInPreparedStatement

JDBC with Spring slow metadata fetch Oracle

帅比萌擦擦* 提交于 2020-01-13 10:08:09
问题 I am using the Spring JdbcUtils.extractDatabaseMetaData() method to analyze the database. The function calls a callback and hands over a DatabaseMetaData object. This object provides the getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) . I call it like this getColumns("",TABLE_OWNER_USERNAME,null,null) and get 400 columns as a result. These are exactly the results that I want, but the request takes over 1 minute. Can I somehow optimize this

hsqldb Oracle mode select for update NOWAIT

不打扰是莪最后的温柔 提交于 2020-01-11 13:03:16
问题 It seems NOWAIT is not supported by HSQLDB in Oracle syntax. HSQLDB version: 2.3.3 with SET DATABASE SQL SYNTAX ORA TRUE; Exception produced on the SQL select a, b, c from sometable where id=1 for update NOWAIT The exception Caused by: org.hsqldb.HsqlException: unexpected token: NOWAIT at org.hsqldb.error.Error.parseError(Unknown Source) at org.hsqldb.ParserBase.unexpectedToken(Unknown Source) at org.hsqldb.ParserCommand.compileStatement(Unknown Source) at org.hsqldb.Session.compileStatement

using Spring JdbcTemplate for multiple database operations

末鹿安然 提交于 2020-01-10 02:06:33
问题 I like the apparent simplicity of JdbcTemplate but am a little confused as to how it works. It appears that each operation (query() or update()) fetches a connection from a datasource and closes it. Beautiful, but how do you perform multiple SQL queries within the same connection? I might want to perform multiple operations in sequence (for example SELECT followed by an INSERT followed by a commit) or I might want to perform nested queries (SELECT and then perform a second SELECT based on

Unable to insert datetimeoffset value using Spring Boot, on SQL Server 2016

回眸只為那壹抹淺笑 提交于 2020-01-06 07:12:34
问题 I have this POJO: public class SomeEntity { private String recordName; private Instant recordDatetime; public SomeEntity(String recordName, Instant recordDateTime) { this.recordName = recordName; this.recordDateTime = recordDateTime; } // Getters and Setters } ...and this corresponding database table defined in a SQL Server 2016 database: CREATE TABLE [dbo].[some_entities]( [record_name] [nvarchar](255) NOT NULL, [record_datetime] [datetimeoffset](7) NOT NULL, CONSTRAINT [PK_some_entities]

Unable to insert datetimeoffset value using Spring Boot, on SQL Server 2016

半腔热情 提交于 2020-01-06 07:09:24
问题 I have this POJO: public class SomeEntity { private String recordName; private Instant recordDatetime; public SomeEntity(String recordName, Instant recordDateTime) { this.recordName = recordName; this.recordDateTime = recordDateTime; } // Getters and Setters } ...and this corresponding database table defined in a SQL Server 2016 database: CREATE TABLE [dbo].[some_entities]( [record_name] [nvarchar](255) NOT NULL, [record_datetime] [datetimeoffset](7) NOT NULL, CONSTRAINT [PK_some_entities]