pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR transaction is read-only
5+ messages / 5 participants
[nested] [flat]
* ERROR transaction is read-only
@ 2007-10-24 15:17 ahnf <interz12@yahoo.com>
0 siblings, 0 replies; 5+ messages in thread
From: ahnf @ 2007-10-24 15:17 UTC (permalink / raw)
To: pgsql-jdbc
I am using the postgresql-8.2.506.jdbc4.jar file
My jdbc connections are setReadOnly(false)
When attempting an insert I get
org.postgresql.util.PSQLException: ERROR: transaction is read-only
ideas?
org.postgresql.util.PSQLException: ERROR: transaction is read-only
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:344)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: ERROR transaction is read-only
@ 2007-10-24 18:22 interz12@yahoo.com
0 siblings, 0 replies; 5+ messages in thread
From: interz12@yahoo.com @ 2007-10-24 18:22 UTC (permalink / raw)
To: pgsql-jdbc
FYI, the connection is non-readonly when I initially create it. After
doing a select, it becomes read-only and I have to manually set it back
to non-readonly. Is this normal???
----- Original Message ----
From: ahnf <interz12@yahoo.com>
To: pgsql-jdbc@postgresql.org
Sent: Wednesday, October 24, 2007 9:17:34 AM
Subject: [JDBC] ERROR transaction is read-only
I am using the postgresql-8.2.506.jdbc4.jar file
My jdbc connections are setReadOnly(false)
When attempting an insert I get
org.postgresql.util.PSQLException: ERROR: transaction is read-only
ideas?
org.postgresql.util.PSQLException: ERROR: transaction is read-only
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:344)
---------------------------(end of
broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
^ permalink raw reply [nested|flat] 5+ messages in thread
* ERROR: transaction is read-only
@ 2011-01-17 21:38 Satish Burnwal (sburnwal) <sburnwal@cisco.com>
0 siblings, 1 reply; 5+ messages in thread
From: Satish Burnwal (sburnwal) @ 2011-01-17 21:38 UTC (permalink / raw)
To: pgsql-jdbc
Hello all,
I am facing a serious issue in my app that uses jdbc and I am not
getting satisfactory answers from the posts either. I have set the conn
auto-commit to false but even after that I am getting the error : ERROR
: transaction is read-only - while executing a batch of 2 statements.
Statement1:
Smt.addBatch("DELETE from table1 where coln1 < 20");
Statement2:
Smt.addBatch("INSERT into table2 (SELECT coln1, coln2 from table3)");
Pls let me know how to resolve this.
Thanks in advance,
-Satish
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: ERROR: transaction is read-only
@ 2011-01-17 22:12 Maciek Sakrejda <msakrejda@truviso.com>
parent: Satish Burnwal (sburnwal) <sburnwal@cisco.com>
0 siblings, 1 reply; 5+ messages in thread
From: Maciek Sakrejda @ 2011-01-17 22:12 UTC (permalink / raw)
To: Satish Burnwal (sburnwal) <sburnwal@cisco.com>; +Cc: pgsql-jdbc
Your transaction is probably being set to read-only somewhere. I'm
going out on a limb and venture that that does not have anything to do
with the code you've showed us. I don't think the driver sets a
connection to read-only on its own anywhere (only through explicit
user caslls to setReadOnly--or, of course, manually issuing a query
such as "SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY" or just
"SET TRANSACTION READ ONLY"). Are you using RO connections anywhere
else? Could this be improper reuse of a read-only connection from a
pool? Can you turn this into an isolated test case or at least provide
more details on what works and what doesn't.
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
msakrejda@truviso.com
www.truviso.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: ERROR: transaction is read-only
@ 2011-01-17 23:28 Samuel Gendler <sgendler@ideasculptor.com>
parent: Maciek Sakrejda <msakrejda@truviso.com>
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Gendler @ 2011-01-17 23:28 UTC (permalink / raw)
To: Maciek Sakrejda <msakrejda@truviso.com>; +Cc: Satish Burnwal (sburnwal) <sburnwal@cisco.com>; pgsql-jdbc
On Mon, Jan 17, 2011 at 2:12 PM, Maciek Sakrejda <msakrejda@truviso.com>wrote:
> Your transaction is probably being set to read-only somewhere. I'm
> going out on a limb and venture that that does not have anything to do
> with the code you've showed us. I don't think the driver sets a
> connection to read-only on its own anywhere (only through explicit
> user caslls to setReadOnly--or, of course, manually issuing a query
> such as "SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY" or just
> "SET TRANSACTION READ ONLY"). Are you using RO connections anywhere
> else? Could this be improper reuse of a read-only connection from a
> pool? Can you turn this into an isolated test case or at least provide
> more details on what works and what doesn't.
>
>
For example, if you are using the spring framework and have
<tx:annotation-driven/> in your context and @Transactional annotations on
classes, I believe the default is to create a read-only transaction. You
must use @Transactional(readOnly=false) to get a read/write transaction. Or
maybe that's just how my metadata is set up. It is possible that you can
define the default transaction type in the transaction manager declaration.
It's been a while since I dug into that stuff. You can put an
@Transactional annotation on the class declaration in order to provide
defaults and then override those defaults with annotations on individual
methods. If you declare your transaction aspects in an application context
file, you can use a naming convention like read-only on methods like get*
and read-write on methods like set* or assign*. I imagine that most
frameworks that abstract transaction handling away from the coder provide
similar mechanisms for defining transaction semantics declaratively.
--sam
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2011-01-17 23:28 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-24 15:17 ERROR transaction is read-only ahnf <interz12@yahoo.com>
2007-10-24 18:22 Re: ERROR transaction is read-only interz12@yahoo.com
2011-01-17 21:38 ERROR: transaction is read-only Satish Burnwal (sburnwal) <sburnwal@cisco.com>
2011-01-17 22:12 ` Re: ERROR: transaction is read-only Maciek Sakrejda <msakrejda@truviso.com>
2011-01-17 23:28 ` Re: ERROR: transaction is read-only Samuel Gendler <sgendler@ideasculptor.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox