Re: MS SQL errors in my script
- From: Jenda@xxxxxxxxxxx (Jenda Krynicky)
- Date: Mon, 21 May 2007 20:41:27 +0200
From: "Jordan Mueller" <jordanmueller@xxxxxxxxx>
Hello,
I am trying to write a script that connects to a remote MS SQL database.
I have set up dsn on my server before and have no problem connecting. But
something is working this time.
I am pasting my script and the error messages below. If nay one has any
experience with MS SQL Errors that would be very helpful.
++++++++++++++++++++++++++++++++++++++++++++++++++
DBI Script
++++++++++++++++++++++++++++++++++++++++++++++++
my $data_source = 'EXAMPLE';
my $dbh = DBI->connect("dbi:ODBC:$data_source", 'test',
'password') || die "unable to connect: $DBI::errstr";
my $statement = 'SELECT * FROM Patients';
...
++++++++++++++++++++++++++++++++++++++++++++
ERRORS
+++++++++++++++++++++++++++++++++++++++++++++
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'Patients'. (SQL-42S02)
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be
prepared. (SQL-42000)(DBD: st_execute/SQLExecute err=-1) at rcmp.pl line 32.
+++++++++++++++++++++++++++++++++++++++++++++
The connection seems to be fine, I don't know what to do about SQL Server
errors.
There is no 'Patients' table in the current database. Either the
table is named differently or you are not in the database you think
you are. Try to review the ODBC data source whether it does specify
the right database to use or add a
$dbh->do('use TheDatabaseName');
after the constructor;
HTH, Jenda
===== Jenda@xxxxxxxxxxx === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
.
- References:
- MS SQL errors in my script
- From: Jordan Mueller
- MS SQL errors in my script
- Prev by Date: MS SQL errors in my script
- Next by Date: Memory leak, DBI 1.55 + DBD::ODBC 1.13 + MS SQL 2000
- Previous by thread: MS SQL errors in my script
- Next by thread: Memory leak, DBI 1.55 + DBD::ODBC 1.13 + MS SQL 2000
- Index(es):
Relevant Pages
|