Advertisement

05.30.2008 at 10:25AM PDT, ID: 23445332
[x]
Attachment Details

perl connection to sql server

Asked by jeet_78 in Perl Programming Language, Sun Solaris

Hello

I am trying to access the sql server 2005 from the solaris operating system. below is the code which i am using.....

while connecting to the server i am getting following error
DBI connect('driver={SQL Server};Server=192.111.17.91; database=FACSOLAPCore;uid
=cibna\x582406;pwd=Apr-2008;','',...) failed: [iODBC][Driver Manager]Specified d
river could not be loaded (SQL-IM003)
[iODBC][Driver Manager]ld.so.1: testdb.pl: fatal: {SQL Server}: open failed: No
such file or directory (SQL-00000)(DBD: db_login/SQLConnect err=-1) at ./testdb.
pl line 10
Database connection not made: [iODBC][Driver Manager]Specified driver could not
be loaded (SQL-IM003)
[iODBC][Driver Manager]ld.so.1: testdb.pl: fatal: {SQL Server}: open failed: No
such file or directory (SQL-00000)(DBD: db_login/SQLConnect err=-1)

Please advice
Any suggestions are welcome ......Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
#!/apps/perl5.8/bin/perl -wT
 
use DBI;
use DBD::Sybase;
 
 
#this is how you connect to MS SQL Server 2005:
 
my $DSN = 'driver={SQL Server};Server=192.111.17.91; database=FACSOLAPCore;uid=c
ibna\x582406;pwd=Apr-2008;';
my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "Database connection not made: $D
BI::errstr\n";
 
#this is how you query the db:
 
# query the database
my $sql = qq{ SELECT * FROM Inventory };
my $sth = $dbh->prepare( $sql );
[+][-]05.30.2008 at 12:00PM PDT, ID: 21680490

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.31.2008 at 12:52AM PDT, ID: 21683054

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Perl Programming Language, Sun Solaris
Sign Up Now!
Solution Provided By: clockwatcher
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628