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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re^3: MSSQL/Perl by mje
in thread MSSQL/Perl by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found