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: AANLkTinRWYvdgx8uQcgjUvX+zoapk_jGaUvjR5bzPmNv@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mladen Gogala 2010-09-14 21:30:28 Neat trick
Previous Message Machiel Richards 2010-09-13 09:50:09 Database integrity ?