473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How to retrieve data from database in different machine?

7
I am currently building a database with 3 tables using Mysql in solaris 9. I have work out my API in windows using dreamweaver. I would like to try linking the API and database by using php and apache server? anyone who can help me solve thi problem?
Apr 8 '07 #1
7 3105
ak1dnar
1,584 Expert 1GB
I am currently building a database with 3 tables using Mysql in solaris 9. I have work out my API in windows using dreamweaver. I would like to try linking the API and database by using php and apache server? anyone who can help me solve thi problem?
So your MySQL Database i running under Solaris and your Apache Web Server is Running Under Windows.
If you Need to Call for Database from your API use the IP Address and MySQL Port of that Solaris Machine.
Apr 8 '07 #2
yoyoz
7
So your MySQL Database i running under Solaris and your Apache Web Server is Running Under Windows.
If you Need to Call for Database from your API use the IP Address and MySQL Port of that Solaris Machine.
Yes. you are right. actually i am new to php, can you just guide me what script should i use? may be can you just give me a sample script? thanks a lot...
Apr 8 '07 #3
ak1dnar
1,584 Expert 1GB
There are lots of sample scripts here for the beginners.
http://www.w3schools.com/php/php_mysql_intro.asp
Apr 9 '07 #4
yoyoz
7
There are lots of sample scripts here for the beginners.
http://www.w3schools.com/php/php_mysql_intro.asp
I had found some php script regarding the connection, but it still can't work.
The error message is:

Warning: mysql_connect(): Can't connect to MySQL server on 'Solaris IP add' (10054) in c:\program files\easyphp1-7\www\view-taxo-solaris.php on line 11
Problem connecting to DataBaseCan't connect to MySQL server on 'Solaris IP add' (10054)

Below is my php script:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SEA Fruit flies Database System<</title>
</head>
<body bgcolor=#ffffff>
<h2>Data from taxo</h2>

<?
$MyConn=mysql_connect("Solaris IP add: port","root","");
if (!$MyConn) {
die ("Problem connecting to DataBase".mysql_error());
}
echo 'Connected successfully';
mysql_close($MyConn);
$query = "select * from taxo order by genus, species";
$result = mysql_db_query("seaff_2007", $query);

if ($result) {
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#99CC00>Subfamily</td>
<td align=center bgcolor=#99CC00>Tribe</td>
<td align=center bgcolor=#99CC00>Subgenus</td>
<td align=center bgcolor=#99CC00>Genus</td>
<td align=center bgcolor=#99CC00>Species</td>
<td align=center bgcolor=#99CC00>Distribution</td>
</tr>";

while ($r = mysql_fetch_array($result)) {

$subf = $r["subfamily"];
$tribe = $r["tribe"];
$subg = $r["subgenus"];
$genus = $r["genus"];
$spe = $r["species"];
$distri = $r["distribution"];


echo "<tr>
<td>$subf</td>
<td>$tribe</td>
<td>$subg</td>
<td>$genus</td>
<td>$spe</td>
<td>$distri</td>
</tr>";
}
echo "</table>";

} else {
echo "No data.";
}

mysql_free_result($result);
?>

</body>
</html>

Should i put all my php file in the Solaris machine as well? Or i need to change any configuration in the Windows or Solaris machine? Just to stress that i would like to call out the data from solaris through my windows machine.
Thanks.
Apr 9 '07 #5
ak1dnar
1,584 Expert 1GB
If didn't change the port number for my sql, the default is 3306.

first try to establish the connection then try to fetch the database values.

[PHP]<?php
$dbcnx = mysql_connect("127.0.0.1:3306","root","dba");
if ($dbcnx)
{
echo 'Success';
}
else
{
echo ' Unable' ;
}
?>[/PHP]

try like this also. with out the port.
[PHP]$dbcnx = mysql_connect("127.0.0.1","root","dba");[/PHP]
make sure to use the ip,username.pwd of your solaris node.
Apr 10 '07 #6
ak1dnar
1,584 Expert 1GB
I had found some php script regarding the connection, but it still can't work.
The error message is:

Warning: mysql_connect(): Can't connect to MySQL server on 'Solaris IP add' (10054) in c:\program files\easyphp1-7\www\view-taxo-solaris.php on line 11
Problem connecting to DataBaseCan't connect to MySQL server on 'Solaris IP add' (10054)

Below is my php script:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SEA Fruit flies Database System<</title>
</head>
<body bgcolor=#ffffff>
<h2>Data from taxo</h2>

<?
$MyConn=mysql_connect("Solaris IP add: port","root","");
if (!$MyConn) {
die ("Problem connecting to DataBase".mysql_error());
}
echo 'Connected successfully';
mysql_close($MyConn);
$query = "select * from taxo order by genus, species";
$result = mysql_db_query("seaff_2007", $query);

if ($result) {
echo "Found these entries in the database:<br><p></p>";
echo "<table width=90% align=center border=1><tr>
<td align=center bgcolor=#99CC00>Subfamily</td>
<td align=center bgcolor=#99CC00>Tribe</td>
<td align=center bgcolor=#99CC00>Subgenus</td>
<td align=center bgcolor=#99CC00>Genus</td>
<td align=center bgcolor=#99CC00>Species</td>
<td align=center bgcolor=#99CC00>Distribution</td>
</tr>";

while ($r = mysql_fetch_array($result)) {

$subf = $r["subfamily"];
$tribe = $r["tribe"];
$subg = $r["subgenus"];
$genus = $r["genus"];
$spe = $r["species"];
$distri = $r["distribution"];


echo "<tr>
<td>$subf</td>
<td>$tribe</td>
<td>$subg</td>
<td>$genus</td>
<td>$spe</td>
<td>$distri</td>
</tr>";
}
echo "</table>";

} else {
echo "No data.";
}

mysql_free_result($result);
?>

</body>
</html>

Should i put all my php file in the Solaris machine as well? Or i need to change any configuration in the Windows or Solaris machine? Just to stress that i would like to call out the data from solaris through my windows machine.
Thanks.
Please use [PHP] [ /PHP] Tags around your Scripts.Read the posting guidelines.
Apr 10 '07 #7
yoyoz
7
Please use [PHP] [ /PHP] Tags around your Scripts.Read the posting guidelines.
i have tried to establish the connection with the IP add of the Solaris machine bt it still cannot work.
what if i have accidentally changed the port number in Solaris? or may be someone else did?
can i know where i can look for the setting? thanks you so much.
Apr 10 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Daniel Tonks | last post by:
First, please excuse the fact that I'm a complete MySQL newbie. My site used forum software that I wrote myself (in Perl) which, up until now, has used flat files. This worked fine, however...
16
by: Daniel Tonks | last post by:
First, please excuse the fact that I'm a complete MySQL newbie. My site used forum software that I wrote myself (in Perl) which, up until now, has used flat files. This worked fine, however...
5
by: Vanessa | last post by:
I have a question, is that any other way to retrieve data from another webpage besides using XML object? Because I am using XML object now but give me so much problems. If I used...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.