php adodb library connect remote mysql

Thread Solved

Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

php adodb library connect remote mysql

 
0
  #1
Apr 17th, 2006
Hi,

I have to connect sometimes to MSSQL and sometimes to MySql depending on the customer. I am experimenting with the php adodb library that claims to make database connection possible to either vendor using the same syntax.

First the background at home I have:

Rig1:
windows XP professional
PHP 5.0.4, IIS 5.1, MSSQL Server 2000 developer edition

Rig2:
Windows XP home
PHP 5.1.1, Apache 2.2.0, MySql 5.0.18-nt

So far if I connect and execute a query on Rig1 using two php files like this it works.

cls_gen_db.conf.php
  1. <?php
  2. $_ADO_INC_PATH = 'C:/Inetpub/phpado';
  3.  
  4. $dbdriver = 'mssql';
  5. $server = 'localhost';
  6. $user = 'myusername';
  7. $password = 'mypassword';
  8. $database = 'mydatabase';
  9.  
  10. include($_ADO_INC_PATH.'/adodb/adodb.inc.php');
  11. ?>

class_generator.php
  1. <html>
  2. <body>
  3. <?php
  4.  
  5. include('cls_gen_db.conf.php');
  6.  
  7. $Thedb = ADONewConnection($dbdriver);
  8. $Thedb->debug = true;
  9. $Thedb->Connect($server, $user, $password, $database);
  10.  
  11. $Thedata = $Thedb->Execute('exec sp_tables');
  12. if ($Thedata == false) die("failed");
  13. print '<table>';
  14. while (!$Thedata->EOF) {
  15. print '<tr>';
  16. for ($i=0, $max=$Thedata->FieldCount(); $i < $max; $i++){
  17. print '<td>';
  18. print $Thedata->fields[$i];
  19. print '</td>';
  20. }
  21. print '</tr>';
  22. $Thedata->MoveNext();
  23. }
  24. print '<table>';
  25. ?>
  26. </body>
  27. </html>

In theory to run a similar query on the MySql on Rig2 (it has same database name and user name setup) all I have to change is these two lines:
  1. $dbdriver = 'mysql';
  2. $server = 'Rig2';

And this line in the other file:
  1. $Thedata = $Thedb->Execute('show tables');

But I get a blank page, no PHP errors ? if I copy the PHP files over to Rig2 and browse them via Apache web server locally it all works, but If PHP on Rig1 tries to query mysql on Rig2, I get nothing, not even an error. If I view source i see <html><body> but nothing else.

I am lost to know what the problem is (The SP2 firewall on Rig2 is configured to allow incoming TCP/IP on port 3306 from any other host on my home LAN)

What gives?
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 32
Reputation: BlazingWolf is an unknown quantity at this point 
Solved Threads: 1
BlazingWolf BlazingWolf is offline Offline
Light Poster

Re: php adodb library connect remote mysql

 
0
  #2
Apr 22nd, 2006
Try using the IP of Rig2 as the $server varible.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC