Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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]
[Discipulus]: with eskimo greeting is a little bit impressing, anyway
[Eily]: I actually used the eskimo greeting :P, I just wrote the "canonical" form of the oneliner here
[Discipulus]: next time you can add `SARGV-1` and if still not impressed pass a 'rm -f..' as last arg
[Eily]: :)
[Eily]: or I might be tempted to send him an Acme::EyeDropsed file next time
[Eily]: Acme::Bleach is tempting, but it will look like I'm just using the one module that does precisely exactly what he wants

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-04-26 15:10 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (482 votes). Check out past polls.