CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
DBI Question



Feb 10, 2001, 7:54 PM

Post #1 of 2 (699 views)
DBI Question Can't Post


If my perl scripts are on 1 server, and the SQL database I need to talk to is on a different server,
is there a way via DBI to connect to that database?

Something like:
my $DSN='dbname';
my $user = "loginname";
my $pass = "password";
my $DBD='ODBC';
my $server='123.456.789.0'
my $DBH=DBI->connect($DSN,$user,$pass,$DBD,$server);

I have read the DBI docs, but no mention is made of this so I was wondering if anyone has seen or done this before.

TIA for any and all assistance!


Feb 10, 2001, 10:08 PM

Post #2 of 2 (696 views)
Re: DBI Question [In reply to] Can't Post

The connection parameters depend which database server you're connecting to (IE MySQL, Oracle...). The host is part of the DSN. I connect "remotely" (both machines are with the same host provider) with:

$dbh = DBI -> connect("", "username", "password", \%attr)

Yes, they run it on the NNTP server. Crazy Keep in mind that the connection between your script host and the database server host will not be secure, so I wouldn't use it to store any sensitive data.

>> If you can't control it, improve it, correlate it or disseminate it with PERL, it doesn't exist!


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives