User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,548 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,530 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3272 | Replies: 1 | Solved
Reply
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,164
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 58
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

php adodb library connect remote mysql

  #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
<?php 
$_ADO_INC_PATH = 'C:/Inetpub/phpado';

	  $dbdriver = 'mssql';
          $server = 'localhost';
          $user = 'myusername';
          $password = 'mypassword';
          $database = 'mydatabase';
          
include($_ADO_INC_PATH.'/adodb/adodb.inc.php');
?>

class_generator.php
<html>
<body>
<?php

	include('cls_gen_db.conf.php');

	$Thedb = ADONewConnection($dbdriver);
	$Thedb->debug = true;
	$Thedb->Connect($server, $user, $password, $database);

	$Thedata = $Thedb->Execute('exec sp_tables');
	if ($Thedata == false) die("failed");
	print '<table>';
		while (!$Thedata->EOF) {
			print '<tr>';
			for ($i=0, $max=$Thedata->FieldCount(); $i < $max; $i++){
				print '<td>';
				print $Thedata->fields[$i];
			       print '</td>';
			       }
		print '</tr>';
 		$Thedata->MoveNext();
		}
	print '<table>';		
?>
</body>
</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:
	  $dbdriver = 'mysql';
          $server = 'Rig2';

And this line in the other file:
	$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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2006
Posts: 32
Reputation: BlazingWolf is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
BlazingWolf BlazingWolf is offline Offline
Light Poster

Re: php adodb library connect remote mysql

  #2  
Apr 22nd, 2006
Try using the IP of Rig2 as the $server varible.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:00 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC