Thread: error on INSERT - connection is read only

error on INSERT - connection is read only

From
"Nisha Srinivasan"
Date:
> Hi,
>
> l see that a lot of people have the same problem and have posted questions
> but I couldn't find an answer on the web.
>
> I have Postgresql 6.5.3 running on Debian Linux.
> And I use the iODBC driver manager 2.50.3 to make the ODBC calls.
>
> Am not able to insert data into Postgres tables across ODBC.
> I can do it using psql though.
>
> odbc.ini has an entry saying readonly = no.
> Also from the C++ program, I set the attribute of connection object as
> writable explicitly.
> If I ping the the connection object it says it's a writable connection.
> And immediately i have a
> connection.prepareStatement()
> call that does an INSERT.
> When this line is executed I get an error saying
> "Connection is readonly, only select statements are allowed."
>
> This error msg comes WITHOUT the [ODBC] tag.
>
> Again when I catch{}  the exception, I ping the connection object.
> It's still a writable connection.
>
> I should also mention that I use FreeODBC++ wrapper.
> But I've searched through their source code and such an error message is
> not defined in .h or .cpp files
>
> I have tried to connect using the postgres superuser as well.
> I have also tried to change my 'pg_hba.conf' file to allow connection as
> trust for all.
> This table has a primary key and permisions GRANTed to public for all
> operations.
>
> Apprecitate your help.
>
> Thanx,
> Nisha

Attachment

Re: error on INSERT - connection is read only

From
Hiroshi Inoue
Date:
Nisha Srinivasan wrote:
> 
> > Hi,
> >
> > l see that a lot of people have the same problem and have posted questions
> > but I couldn't find an answer on the web.
> >
> > I have Postgresql 6.5.3 running on Debian Linux.
> > And I use the iODBC driver manager 2.50.3 to make the ODBC calls.
> >
> > Am not able to insert data into Postgres tables across ODBC.
> > I can do it using psql though.
> >
> > odbc.ini has an entry saying readonly = no.

I may be off the point because I'm not an user of psqlodbc
driver under unix. There seems to be several restrictions
to describe odbc.ini though I don't know the reason.

1) Do you mean ~/.odbc.ini(user DSN?) by odbc.ini ?
2) Don't you have tabs between 'readonly' and '=' ?
3) Current driver is case sensitive in reading odbc.ini  and 'readonly' must be 'ReadOnly'.

regards,
Hiroshi Inoue