Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: 'use database' for sqlserver

by fionbarr (Friar)
on May 21, 2013 at 20:22 UTC ( [id://1034602]=note: print w/replies, xml ) Need Help??


in reply to Re: 'use database' for sqlserver
in thread 'use database' for sqlserver

didn't work at all. Is there something on the order of 'dbh->do("use $database")'

Replies are listed 'Best First'.
Re^3: 'use database' for sqlserver
by roboticus (Chancellor) on May 22, 2013 at 13:54 UTC

    fionbarr:

    I'd be surprised if $dbh->do("use $database") didn't work. Did you try it and have it fail?

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      I did try it and it failed.
        $ perl -le 'use DBI; my $h = DBI->connect("dbi:ODBC:DRIVER={Easysoft O +DBC-SQL Server};server=172.20.0.39\\SQLEXPRESS;UID=xxx;PWD=yyy;"); $h +->{RaiseError} = 1;$h->do(q/use master/); $ echo $? 0 $ perl -le 'use DBI; my $h = DBI->connect("dbi:ODBC:DRIVER={Easysoft O +DBC-SQL Server};server=172.20.0.39\\SQLEXPRESS;UID=xxx;PWD=yyy;"); $h +->{RaiseError} = 1; $h->do(q/use fred/);' DBD::ODBC::db do failed: [unixODBC][Easysoft][SQL Server Driver 11.0][ +SQL Server]Database 'fred' does not exist. Make sure that the name is + entered correctly. (SQL-08004) at -e line 1.

        I don't have a 'fred' database. Works for me but of course your probably using a different ODBC driver for SQL Server.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1034602]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found