I am connecting to a netzezza database using ODBC. I have worked on this tiny bit of code for a few days and I keep getting an error:
DBD::ODBC::st execute failed: ERROR: Cross Database Access not supported for this type of command (SQL-HY000) at line 20.
Line 20 is $sth-> execute(). I am not crossing databases so I don't understand what is causing this error. I can replace the update statement with a select, and the program runs correctly.
This is the code:
use strict;
use warnings;
use DBI;
use DBD::ODBC;
DBI->trace(0);
my $dbh = DBI-> connect('dbi:ODBC:system', 'user', 'pwd')
or die "Couldn't connect to database: " . DBI->errstr;
my $stmt= "update db_name.user.table_name set column_name= 8 where column_name2 like 'someValue'";
#my $stmt= "select column_name1, column_name2 from db_name.user.table_name where column_name2 like 'anotherValue'";
my $sth;
$sth = $dbh->prepare($stmt)
or die "Couldn't prepare statement:". $dbh->errstr;
$sth-> execute() #Execute the query
or die "Couldn't execute statement:".$dbh->errstr;
$sth->finish();
$dbh->disconnect;
use DBI;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.