Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: MSSQL/Perl

by mje (Curate)
on Sep 30, 2013 at 08:57 UTC ( #1056315=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: MSSQL/Perl
in thread MSSQL/Perl

Apart from all the other things people have told you about this script:

  1. 'DBI:ODBC:' should be 'dbi:ODBC:'
  2. $connect_string should use uppercase for 'driver' e.g., DRIVER.
  3. I see you commented out PrintError and RaiseError and I'm guessing you did that because you couldn't work out how to pass them to connect without supplying another username and password as connect is (connect_string, username, password, attributes). You can either a) just set RaiseError/PrintError off the $dbh after connect e.g., $dbh->{PrintError} = 0 or b) take UID=$user;PWD=$password out of your $connect_string and pass them as the 2nd and 3rd args to DBI's connect then put your commented code as the 4th argument.
  4. You don't need to use DBD::ODBC. DBI loads that for you. The only time you might want to use DBD::ODBC is if you needed some symbols it does not export by default.
  5. I doubt you want to include host=localhost as I don't believe any SQL Server Server drivers use that connection attribute - but I've not seen them all.
  6. I'd be surprised if you really had an ODBC driver called "SQL Server" as I've never seen that on unix (and other comments in this thread seemed to suggest you were using unix). The string you assign to DRIVER needs to be a driver located in you odbcinst.ini file - it will be a name between square brackets - see example below.
[Easysoft ODBC-SQL Server] Driver=/usr/local/easysoft/sqlserver/lib/libessqlsrv.so Setup=/usr/local/easysoft/sqlserver/lib/libessqlsrvS.so Threading=0 FileUsage=1 DontDLClose=1 UsageCount=27


Comment on Re^3: MSSQL/Perl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-12-26 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (168 votes), past polls