Re: MS SQL errors in my script



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

.



Relevant Pages

  • RE: Backups have Shadow Copy Problems
    ... and restarted the server. ... suggested and changed the recovery model to simple on the one database called ... I understand the issue to be: the backup task failed ... You back up data from a volume that contains a Microsoft SQL Server ...
    (microsoft.public.windows.server.sbs)
  • Re: upsizing to sql 2005
    ... the word SERVER in it, ... You can access to the database by multiple means (Access, ... and how does it update the SQL database with the new records in Access? ... Query Name: Arcadia - ARC ...
    (microsoft.public.access.queries)
  • Re: Linked Tables in Access
    ... any use of SQL Passthru, Linked Tables or any other use of MDB / MDE ... server, or would I also need to convert *those* queries to passthrough ... I've been trying to understand why Access database files become corrupt. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Leveling by ID vs. "Standard"
    ... of this trade called Project Management. ... a database for the "Project Tables," ... to write reports on data from the server database. ... product supporting queries created with SQL. ...
    (microsoft.public.project)
  • Re: Trouble Getting VS.Net 2003 WalkThroughs MSDE Connection
    ... Config Tool of SQL Server? ... > link to download the PUBs database. ... >>> Setup and they directed me to install MSDE and they attached a ...
    (microsoft.public.sqlserver.msde)