Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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/ Setup=/usr/local/easysoft/sqlserver/lib/ Threading=0 FileUsage=1 DontDLClose=1 UsageCount=27

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056315]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2017-03-26 05:34 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.