Jason Whitlow wrote:

> Sorry for for the dumb question buuuuuuut.
>
> I have been connecting to a database on my localhost using perl's DBI.pm
>
> This is how I currently do it.
>
> use DBI;
> $data = "databasename";
> $driver = "DBI:mysql";
> my $dbh = DBI->connect("$driver:database=$data", "username", "password")
>         or die "Can't connect";
>
> How would I connect to the same database on a remote server.

>From the top of 'man DBD::mysql':
           use DBI;


           $driver = "mysql";
           $dsn =
"DBI:$driver:database=$database;host=$hostname;port=$port";


You can also do $dbh= DBI->connect( "dbi:mysql:$db;host=$host", ...);

b.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to