David,

I apologize, I just realized I was responding only to you, and not cc'ing
the rest of the group. Here is the connection info cut straight out of a
call-tracking app I wrote. The dbi, and dbd::odbc are installed on the local
machine, and the MySQL daemon is running on another machine. This is exactly
how it worked. substitute your own IP address and port number for where your
MySQL daemon is running, and of course, the user and password information
and it should connect, and work.

Steve Howard

 use DBI;
  my $database_name     = 'intra_data';
  my $location          = '10.17.191.100';
  my $port_num          = '3306'; # This is default for mysql



  # define the location of the sql server.
  my $database          = "DBI:mysql:$database_name:$location:$port_num";
  my $db_user           = "sa";
  my $db_password       = "sa";

  # connect to the sql server.
  my $dbh       = DBI->connect($database,$db_user,$db_password);



my $sql_statement = "SELECT call_no FROM calltrac ORDER BY call_no DESC
LIMIT 1";

my $sth = $dbh->prepare($sql_statement);

  my ($call_no);

$sth->execute() or die "Can't execute SQL statement : $dbh->errstr";
  $sth->bind_columns(undef, \$call_no);
  my $row;

while ($row = $sth->fetchrow_arrayref) {


#you get the idea

-----Original Message-----
From: David Coley [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 26, 2001 8:58 PM
To: [EMAIL PROTECTED]
Subject: RE: Using DBI when MySQL is on another server


>From the two responces I've gotten back, I know I didn't phrase this right.

My problem is when I get to the point:

Where is your MySQL installed? Please tell me the directory that
contains the subdir 'include'. [/usr/local]
Cannot find one of include/mysql/mysql.h, include/mysql.h in /usr/local at
lib/D

I need to tell it that MySQL is located on a differnt server and not the
local machine... is there a way around this?  And still give me access to
DBI on this machine?

David Coley


-----Original Message-----
From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 26, 2001 9:44 PM
To: David Coley; [EMAIL PROTECTED]
Subject: RE: Using DBI when MySQL is on another server


Read DBD::mysql for proper connect statement.  One of them should have a
specified location of mysql which can be a network address I believe.

Ilya Sterin

-----Original Message-----
From: David Coley [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 26, 2001 9:31 PM
To: [EMAIL PROTECTED]
Subject: Using DBI when MySQL is on another server


I've looked through the docs on this so I thought I'd go to the horse mouth.
We use MySQL however it is on a different server than the Application will
be running.  I want to use DBI with MySQL support in order to help handle my
perl calls to MySQL, however when I get to the line asking for where MySQL
is installed I do not know what to do.  Can DBI run on a different server
than the on that MySQL is install on?  I figure it must be able to since you
can access MySQL from differnt Servers.

Any help appreciated.  Sorry if this question has been answered, I have not
found any archives of the list.

David Coley

Reply via email to