Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

adding DSN to a machine

by Anonymous Monk
on Apr 06, 2001 at 04:25 UTC ( [id://70359]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have played around a bit with Win32::ODBC and have been quite successful. My issue now is I want to create a standalone app that will run on a given users machine, problem is not all machine have the DSN for the database added. I don't want to walk around to all the machine to add it, is there a way to add it from perl code?

Replies are listed 'Best First'.
Re: adding DSN to a machine
by rchiav (Deacon) on Apr 06, 2001 at 06:34 UTC
    Does anyone know if Win32::ODBC supports ADO? If it does, you can set up your connection string to be DSN-less.

    For example, for an access database, you'd set up the connection string as follows..

    "DBQ=C:\path\to\you.mdb;DRIVER={MS Access (*.mdb)}"

    and for an MS SQL connection..

    "Provider=SQLOLEDB; Data Source=Server_Name; Initial Catalog=DatabaseName; User ID=UserID; Password=Password"

    This way you won't have to install DSN's on any of the machines. There's a bunch of debaet over performace.. some people saying that it's better DSN-less and others saying it's slower. I can't weigh in on that, but it will help you with you problem..

    Hope this helps..

    Rich

    UPDATE The first example is NOT ADO. It should work regardless of whether or not Win32::ODBC supports ADO though... it's just a standard DSNless connection. There's an ADO method to connect to access database also. If you need more info on any of this, let me know and I'll dig up some more info.

Re: adding DSN to a machine
by myocom (Deacon) on Apr 06, 2001 at 06:26 UTC

    You don't even need to add a DSN to each machine. As you can see in the Win32::ODBC docs, you can use a connection string instead:

    my $dsn = 'DSN=SomeDataBase;UID=Foo;PWD=Bar'; my $odbc = new Win32::ODBC($dsn);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found