Skip site navigation (1) Skip section navigation (2)

transaction is read-only error

From: Salil Wadnerkar <rohshall(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: transaction is read-only error
Date: 2010-09-14 09:31:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I am experimenting with GNUMed EMR which uses a Mirth (HL7 engine)
channel to write data into postgreSQL table (JDBC) and I am getting
the error - "transaction is read-only".
I think it is because "default_transaction_read_only" is set to true
for this database.
The javascript (Mirth uses Javascript which it conerts to Java I
think) for this is:

var dbConn = DatabaseConnectionFactory.createDatabaseConnection('org.postgresql.Driver','jdbc:postgresql://localhost:5432/gnumed_v10','gm-dbo','gm-dbpass');

[some code to calculate the update parameters]

       sqlquery = "INSERT INTO clin.incoming_data_unmatched
(request_id, firstnames, lastnames, dob, postcode, other_info, gender,
requestor, data) VALUES ('" + request_id + "', '" +
$('patient_firstname') + "', '" + $('patient_lastname') + "', '" +
$('patient_dob') + "', '" + postcode + "', '" + other_info + "', '" +
$('patient_gender') + "', '" + requestor + "', '" + msg + "')";
       result = dbConn.executeUpdate(sqlquery);

This last line generates the error. So, I gave superuser permission to
this user gm-dbo because I think non-superusers cannot change
"default_transaction_read_only" to true.
And I added the following lines before this update command:

	   // Salil: added alter database command
       sqlquery = "alter database gnumed_v10 set
default_transaction_read_only to off";
       result = dbConn.executeUpdate(sqlquery);

But, PostgreSQL generates the error for the executeUpdate of this
newly added command now.

How should I go about updating the table in this database?



pgsql-novice by date

Next:From: Mladen GogalaDate: 2010-09-14 21:30:28
Subject: Neat trick
Previous:From: Machiel RichardsDate: 2010-09-13 09:50:09
Subject: Database integrity ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group