Well I know you can use DBI and ODBC to insert fine, I was doing that from
Win 32 very recently.
I know the platform is different, but DBI is still the underlying
interface with a different ODBC connection.
I don't suppose the option for the cursor type makes a difference does it? I
know it says its for concurrent sql statements but I used the option for
some reason, just can't recall the specifics.
my $dbh = DBI->connect("dbi:ODBC:$DSN",user,user_password,{ RaiseError =>
1,odbc_cursortype => 2 }) or die "ERROR: ",$DBI::errstr,"\n" ;
The only other difference is that I prepare the sql with param binding
placeholders.
-----Original Message-----
From: Alexander Medina [mailto:[EMAIL PROTECTED]
Sent: 25 June 2008 16:24
To: [email protected]
Subject: Cannot run INSERT statement over odbc connection to postgres db
Hi Everyone;
I'm new to this list... Here's what I'm trying to do:
I have a postgresql database running on a Mac G5 tower. I have a perl
script that is making a ODBC connection to a MSSQL database, extracting a
long list of users and email addresses and then making a database connection
to the postgres database, and inserting them into a table.
I have verified that each of these individual statements work, and the MSSQL
connection works, as I have printed the results to a file. However, when
the script gets to the point to do the INSERT script on the Postgres, I get
the following error message:
"DBD::ODBC:db prepare failed: [unixODBC]Connection is readonly, only select
statements are allowed. (SQL-HY000)"
Now, I know the permissions are okay, because I can run the INSERT
statements directly on the database using PgÅdmin or the isql client from
unixODBC. It's just the DBI connection from perl that is only allowing a
readonly connection.
This is the DBI statement that fails due to the readonly permissions:
$dbh=DBI -> connect("dbi:ODBC:server","postgres",);
$sth=$dbh -> prepare($statement);
$rv=$sth -> execute();
The statement actually fails upon execute.
I suppose the real issue is, is this a DBI problem, or a postgres problem?
I wonder is there a DBI switch that will enable the execute to connect with
write, or is it defaulting to a readonly connection?
Thanks,
Alex Medina-
Information in this email including any attachments may be privileged,
confidential and is intended exclusively for the addressee. The views expressed
may not be official policy, but the personal views of the originator. If you
have received it in error, please notify the sender by return e-mail and delete
it from your system. You should not reproduce, distribute, store, retransmit,
use or disclose its contents to anyone. Please note we reserve the right to
monitor all e-mail communication through our internal and external networks.
SKY and the SKY marks are trade marks of British Sky Broadcasting Group plc and
are used under licence. British Sky Broadcasting Limited (Registration No.
2906991), Sky Interactive Limited (Registration No. 3554332), Sky-In-Home
Service Limited (Registration No. 2067075) and Sky Subscribers Services Limited
(Registration No. 2340150) are direct or indirect subsidiaries of British Sky
Broadcasting Group plc (Registration No. 2247735). All of the companies
mentioned in this paragraph are incorporated in England and Wales and share the
same registered office at Grant Way, Isleworth, Middlesex TW7 5QD.