Balasan: RE: Balasan: RE: Balasan: RE: can't execute "use $database"



Dear Garrett.... it still doesn't work.

Here is the error message:
Can't locate DBI/ADO.pm in @INC (@INC contains: C:\Program Files\ActiveState Perl Dev Kit 6.0\lib\ C:/Perl/site/lib C:/Perl/lib .) at cldump.pl line 8.
BEGIN failed--compilation aborted at cldump.pl line 8.

Please tell me furthermore.

here is my code:
#####
use strict;
use DBI::ADO;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';
use warnings;
my $uname="sa";
my $pword="penguin";
my $host="127.0.0.1";
my @bd4l=("FinanCore");
#if (@ARGV){
#my @bd4l=@ARGV;
#}else{
#my @bd4l=("AprovaApp1");
#}
print "I am dumping... @bd4l\n";
foreach my $elemenbd4l(@bd4l){
my $dsn = "Provider=SQLNCLI;"
. "Server=$host;"
. "Database=$elemenbd4l;";
my $dbh1 = DBI->connect("dbi:ADO:$dsn", $uname, $pword) or die $DBI::errstr;

####

"Garrett, Philip (MAN-Corporate)" <Philip.Garrett@xxxxxxxxxxx> wrote:
Patrix Diradja wrote:
Yeah, that's the problem Garrett.

I usually use that way to connect to ms msql.

But now, I want that my perl code can work with several databases.
So I need somewhat like the Connection String which I can modify
(forming string) and than just does "$dbh->connect(<> for me>>)". and does "$dbh->close" before doing again connect to
another database ($dbh->connect).

Ok, try this: (found on www.connectionstrings.com)

my $connstr = "Provider=SQLNCLI;"
.. "Server=$server;"
.. "Database=$database;";

my $dbh = DBI->connect("dbi:ADO:$connstr",$user,$pass)
|| die $DBI::errstr;

If you are using SQL Server 2005 Express, you'll need to add \EXPRESS
after the server name like this:
"Server=$server\\EXPRESS;"

Philip





---------------------------------
Kunjungi halaman depan Yahoo! Indonesia yang baru!

Relevant Pages

  • Re: Backing Up Mirrored database
    ... Tibor Karaszi, SQL Server MVP ... > all databases; and both run successfully without any issues. ... "Attempt to backup but receives an error message from the engine so the job fails"? ...
    (microsoft.public.sqlserver.tools)
  • Re: Longest SQL runtime??
    ... What does "stop saving" mean? ... Do you get an error message at runtime, ... I have had much longer uptimes than that with databases measured in the ... SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Scheduling a Daily Backup of a SQL Database
    ... I was able to find a useful error message, ... cause any issues or downtime to the SQL server? ... as if they are only set to SIMPLE you just need to backup the database. ... have found out how to backup ypur databases, you should be sure that you are ...
    (microsoft.public.sqlserver.server)
  • Re: Suspect
    ... why would it need to sync with the Log files? ... there has been no activity on these databases ... See the SQL Server errorlog for more information ... But the error message is ...
    (microsoft.public.sqlserver.server)
  • Re: why>?
    ... On your desktop-- you'll be running SQL Server behind the scenes. ... it isn't risky to allow end users to create databases. ... it is no more risky than giving you the ability to create spreadsheets. ... I'm not saying that Oracle and IBM are going away. ...
    (microsoft.public.excel)