transaction is read-only error - Mailing list pgsql-novice

From Salil Wadnerkar
Subject transaction is read-only error
Date
Msg-id AANLkTinRWYvdgx8uQcgjUvX+zoapk_jGaUvjR5bzPmNv@mail.gmail.com
Whole thread Raw
Responses Re: transaction is read-only error  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-novice
Hi,

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?


regards
Salil

pgsql-novice by date:

Previous
From: Machiel Richards
Date:
Subject: Database integrity ?
Next
From: Mladen Gogala
Date:
Subject: Neat trick