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

Re: Use DBI for pc-name\SQLEXPRESS

by anonymized user 468275 (Curate)
on Aug 06, 2018 at 09:35 UTC ( [id://1219932]=note: print w/replies, xml ) Need Help??


in reply to Use DBI for pc-name\SQLEXPRESS

The syntax is:-
use DBI; $dbh = DBI->connect('dbi:ODBC:DSN=mydsn', 'user', 'password');
See DBD::ODBC

One world, one people

Replies are listed 'Best First'.
Re^2: Use DBI for pc-name\SQLEXPRESS
by FloydATC (Deacon) on Aug 06, 2018 at 11:20 UTC

    I don't use "DSN=" in my working code, just the exact DSN name as it appears between brackets in my odbc.ini

    Works fine against several different instances with different versions, default and named instances both Express, Standard and Enterprise.

    my $dbh = DBI->connect("dbi:ODBC:$instance", "########", "########");

    For the sake of completeness, here are some example entries (anonymized) from odbc.ini:

    [SRV2] Description = A default instance and port specified because server isn +'t running a "browser" listener. Driver = FreeTDS Server = n.n.n.n Port = 1433 Database = whatever TDS_Version = 9.0 try server login = yes [SRV1-INST1] Description = A named instance, no port specified because so it will u +se the "browser" listening port Driver = FreeTDS Server = n.n.n.n\INST1 Database = whatever TDS_Version = 9.0 try server login = yes
    -- FloydATC

    I got 99 problems, most of them have to do with printers.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found