Balasan: RE: can't execute "use $database"
- From: patrixdiradja@xxxxxxxxxxx (Patrix Diradja)
- Date: Thu, 8 Feb 2007 01:11:10 +0700 (ICT)
Dear my friend, Garret.
I Use Perl on Windows Vista, MS SQL Server 2005, DBI, ADO.
I create 'myperl' as DSN from ODBC Administration Tools.
Here is my connection string:
my $dbh1 = DBI->connect("dbi:ADO:database=gua;host=127.0.0.1;port=1433", $uname, $pword)
|| die "Could not open SQL connection."
But why the connection is failed?
Here is the error message:
DBI connect('database=gua;host=127.0.0.1;port=1433','sa',...) failed: Can't Open Connection 'database=gua;host=127.0.0.1;port=1433'
Please tell me why.
"Garrett, Philip (MAN-Corporate)" <Philip.Garrett@xxxxxxxxxxx> wrote:
Patrix Diradja wrote:
Dear my friends,
I wonder why my perl can not execute query "use $database".
Sorry, I don't know for sure, but my guess is that the "use "
command is a *client* command, and not valid SQL.
Generally speaking, when you want to connect to a specific database, it
should be part of your DSN. You would specify the database name in the
Windows ODBC manager. Or, if you're using connect strings, you'd
specify it there.
Your code indicates that, at some point, you will want to connect to
several different databases using the same DSN. Rather than trying to
force the same $dbh to connect to a different database, why not
disconnect and then reconnect to the new database?
Regards,
Philip
---------------------------------
Sekarang dengan penyimpanan 1GB
http://id.mail.yahoo.com/
- Follow-Ups:
- RE: Balasan: RE: can't execute "use $database"
- From: Philip Garrett
- RE: Balasan: RE: can't execute "use $database"
- References:
- RE: can't execute "use $database"
- From: Philip Garrett
- RE: can't execute "use $database"
- Prev by Date: Balasan: RE: can't execute "use $database"
- Next by Date: RE: Balasan: RE: can't execute "use $database"
- Previous by thread: Balasan: RE: can't execute "use $database"
- Next by thread: RE: Balasan: RE: can't execute "use $database"
- Index(es):
Relevant Pages
|
Loading