Saturday, 15 February 2014

oracle11g - Make PostgreSQL transaction management like Oracle -


I'm looking to port a Java-Spring app from Postgrass SQL to Oracle. I am making a lot of difference between the way to handle transactions. I'm having trouble with this statement:

  Public ZeroArt (String Username, String Poinam, String Pivo) {Object [] Args = {P Well, Pimm, Username}; Try JDbcTemplate.update (INSERT_USER_PREFERENCE, Args); } Grip (duplicate ke EX) {jdbcTemplate.update (UPDATE_USER_PREFERENCE, args); }}  

It works fine in Oracle, but it fails in PostgreSQL because PostgreSQL does not allow further commands in transactions if there is a failure and it wants you to rollback Or want to commit

  (SQL state [25P02]; Error code [0]; Error: Current transaction has been aborted, ignored at the end of transaction block Order; nested exception org.postgresql.util.PSQLException: error: current transaction is canceled, orders Shows have been ignored till the end of the transaction block)  

This is very specific for PostgreSQL, what is the use of postgresql as oracle (and other databases) The way?

Here is my datasource setup:

  & lt; Bean id = "portalDataSource" Class = "org.apache.commons.dbcp.BasicDataSource" destroy-method = "close" & gt; & Lt; Property Name = "driverClassName" value = "org.postgresql.Driver" /> & Lt; Property name = "url" value = "$ {test.database.url}" /> & Lt; Property name = "user name" value = "$ {test.database.username}" /> & Lt; Property name = "password" value = "$ {test.database.password}" /> & Lt; / Bean & gt; & Lt; Bean id = "txManager" class = "org.springframework.jdbc.datasource.DataSourceTransactionManager" & gt; & Lt; Property name = "data source" riff = "portal data source" /> & Lt; / Bean & gt;  


No comments:

Post a Comment