Connecting To A Remote Database

free web hosting
Free Web Hosting > Computers & Tech > Databases

Connecting To A Remote Database

glodrop
I wondered if anyone here can help.

I have a database on a remote server (A). I want to access it through a php script on a different server C.

I have allowed access on (A) in Cpanel - mysql dbases - Remote Access by putting the IP address of server C

The host of server (A) has also whitelisted the IP of server C.

Though I am having trouble connecting from server C which is with a different webhost.

any ideas how to get round this?

I have though of SSH forwarding, but I think this can only be used to connect a client - e.g. my pc to the remote server A. I do not have shell access on server C

I have thought of accessing through SSH on an additional server B - but I can't get my head round any of it or see how the final php settings are going to end up.

Reply

faulty.lee
QUOTE(glodrop @ Apr 22 2008, 07:42 PM) *
Though I am having trouble connecting from server C which is with a different webhost.

any ideas how to get round this?

Can you access the database on server A from your down PC? If server A's database cannot be access external, maybe it's not meant to be done as such. You can write php script as proxy to do the query and return the result in xml form. You can refer to SQLYog, it's using such method to bypass those server that doesn't allow external access. Though the proxy feature is only available in the enterprise version of SQLyog. The opensource free version doesn't not. Anyway, you can get a trial version and find out how it works. If you're not doing much query, you can also write the php script for a limited number of function.

I'ven't really tested this. http://www.phpclasses.org/browse/package/4000.html. But it should works. Or you can look for something similar.

QUOTE(glodrop @ Apr 22 2008, 07:42 PM) *
I have though of SSH forwarding, but I think this can only be used to connect a client - e.g. my pc to the remote server A. I do not have shell access on server C

I have thought of accessing through SSH on an additional server B - but I can't get my head round any of it or see how the final php settings are going to end up.


Not sure about SSH. Normally there's simple way to solve problem. If it ended up with complex solution, think again, there's always simpler ones.

 

 

 


Reply

glodrop
Hi,

Firstly I tried testing access on from my pc through telnet to the remote server A and I just get '4.1.22-standard' and 25 ascii
characters and a flashing cursor.

My host has just installed ssh for me on the cpanel so i'll try and test it through that. I'm new to telnet and ssh.

The script you gave a link for. I will try and test the server with that as well - though my goal is to not just to execute queries.

The database is a directory of websites on server A. On server C is the php script which will access that database. Instead of inputting 'localhost' in the config file I would add the ip of server C. Though when I have done that I have not had much luck - I just get the message -

Can't connect to MySQL server on 'IP for server A' (4) in
/home/a9463775/public_html/directory/index.php on line 72

I wrote $db_host = 'IP for server A:3306' in the config file.

My host of the remote server A assures me that it should work, it is remotely accessible, they have whitelisted the IP and port 3306 is open.

The php script on server C is meant to update the database with new data as well as perform search queries on existing data in the database on server A. It is like any other directory php script with it normally accessing the database on 'localhost'

Any other ideas on this?

Reply

faulty.lee
QUOTE(glodrop @ Apr 22 2008, 10:28 PM) *
Firstly I tried testing access on from my pc through telnet to the remote server A and I just get '4.1.22-standard' and 25 ascii
characters and a flashing cursor.

My host has just installed ssh for me on the cpanel so i'll try and test it through that. I'm new to telnet and ssh.


If you can telnet in via 3306, then it's accessable externally. Though you won't be able to do anything via your telnet connection, it's not meant to be connected that way. Thus, I don't see the purpose for ssh connection too. SSH is a secure version of telnet.

QUOTE(glodrop @ Apr 22 2008, 10:28 PM) *
The database is a directory of websites on server A. On server C is the php script which will access that database. Instead of inputting 'localhost' in the config file I would add the ip of server C. Though when I have done that I have not had much luck - I just get the message -

Can't connect to MySQL server on 'IP for server A' (4) in
/home/a9463775/public_html/directory/index.php on line 72

I wrote $db_host = 'IP for server A:3306' in the config file.

My host of the remote server A assures me that it should work, it is remotely accessible, they have whitelisted the IP and port 3306 is open.


It seems more that your server C is having problem accessing external databases. Some web server denied external socket connection, to prevent usage for illegal purposes. You can try connect to another external database to confirm, or check with server C's host

Reply

yordan
It has to work.
I did it with a phpbb3 forum, I had php on one system and the dabase on the other system.
So, instad of defining the database server as "localhost" I defined it with the connect hotname and host port given by the database server, and it worked.
Yordan

Reply

glodrop
Hi,

My host on server A suggested me testing it via telnet. Is the reason why I just get a load of ascii characters - because its not meant to be used that way. ? It seems that I am connecting. Is that what I am supposed to get on telnet?

Server C is a free host, server A isn't, so I can't get anything from server C, I've tried communicating with them before on this. I have tried accessing the dbase uploaded to other remote(free) hosts though they had a firewall themselves, I couldn't connect to the database there either. Which is why I thought i'd go over to paid hosting and have IPs whitelisted.

Is there anyway round accessing it through an external socket, and instead access solely with the IP?

I would therefore put $db_host = 'IP for server A' without the port in the config file.

or any other ideas????

Yordan - what is different about the way your servers are set up as opposed to the ones I'm using?

It is correct to write the port with the ip as ip:port in place of 'localhost' ?? in the php script.

Reply

faulty.lee
QUOTE(glodrop @ Apr 22 2008, 11:33 PM) *
My host on server A suggested me testing it via telnet. Is the reason why I just get a load of ascii characters - because its not meant to be used that way. ? It seems that I am connecting. Is that what I am supposed to get on telnet?


Yes, that's what you should be getting, meaning, you don't even need whitelist, the port is already open, and they allow external access

QUOTE(glodrop @ Apr 22 2008, 11:33 PM) *
Server C is a free host, server A isn't, so I can't get anything from server C, I've tried communicating with them before on this. I have tried accessing the dbase uploaded to other remote(free) hosts though they had a firewall themselves, I couldn't connect to the database there either. Which is why I thought i'd go over to paid hosting and have IPs whitelisted.

Why not just host your pages and database on the same server. If you're worried about your domain name, you can assign it to another server of your choice.

QUOTE(glodrop @ Apr 22 2008, 11:33 PM) *
Is there anyway round accessing it through an external socket, and instead access solely with the IP?

I would therefore put $db_host = 'IP for server A' without the port in the config file.

or any other ideas????

Yordan - what is different about the way your servers are set up as opposed to the ones I'm using?

It is correct to write the port with the ip as ip:port in place of 'localhost' ?? in the php script.

Yes, that's the way to put the port. If you ignore the port, it will use the default 3306. So, if you're using default port, you don't have to put it in the config. IP alone will do. I guess you mean "route" (round), since you can't make socket connection, i guess you can't route also, you still need a socket connection to route.

Reply

glodrop
I don't host my pages and database together on the same server as the domain name is a sub-domain of the free host; I can't just change nameservers. I am running out of space on server C and server C doesn't allow upgrades. It would also be useful to have a few sites on different servers accessing the same database

Would it be possible to have a port eg. 22 or 2222 with the ip - to read as ip:22 in the php script and then once connected to server A it would then be forwarded to port 3306 still giving the necessary login and password.

Perhaps server C is only denying external socket connection for port 3306, perhaps not for all the ports????

How could I set this up to work on server A?

Perhaps I could ask the host of server A to assign my database to a different port. Though if server C is not denying external socket connection for all ports - which would be the best port to use?

Reply

faulty.lee
QUOTE(glodrop @ Apr 23 2008, 01:49 AM) *
Perhaps server C is only denying external socket connection for port 3306, perhaps not for all the ports????


Denial of external socket connection means all ports. You should first try to confirm if server C is in fact denying all external socket connection including MySQL.

It's really not worth the effort to setup proxy via php. It's a very complex solution for a very simple problem. Running php based proxy will make you face more problem later, as proxy require more direct access to the host's hardware as oppose to conventional method. 99% of all web host limit such functionality as it post a huge risk of security.

You can setup redirection to your subdomain on server C to your server A and host everything there. You can keep those non data related pages/images on server C if space is a constrain. Though the best practice is still keeping everything under one roof for easy maintenance and faster access(performance)


Reply

yordan
Maybe your database server has a problem.
I would suggest, for debugging purposes, to use a public free database server.
For instance, try http://www.freemysql.net/v2/ , register to an account, create a database, use their phpmyadmin to verifiy that the database is functionnal, and then try to remotely connect to your database.
I don't like freemysql.net because their control panel has a lot of ads and popups ; however, their remote database server works fine, so for testing purposes it's OK.
yordan

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. connecting to a remote database pl sql developer - 0.89 hr back. (1)
  2. are there any free remote database for testing - 19.48 hr back. (1)
  3. mediawiki remote database - 22.84 hr back. (1)
  4. pl sql connection to remote db - 26.94 hr back. (1)
  5. trouble connecting to northwind database - 33.54 hr back. (1)
  6. query from remote database php - 40.93 hr back. (1)
  7. connecting to remote remote database using php - 42.88 hr back. (1)
  8. how to move database from localhost to ftp sever using sqlyog - 56.00 hr back. (1)
  9. connecting to remote database from pl/sql block - 62.27 hr back. (1)
  10. transferring db to new server and connecting - 62.40 hr back. (1)
  11. direct connection to remote database using toad - 64.54 hr back. (1)
  12. dreamweaver 8 not connecting to a remote mysql db - 65.11 hr back. (1)
  13. connecting to remote databases in .net - 66.05 hr back. (1)
  14. how to connect remote dsn - 66.23 hr back. (1)
Similar Topics

Keywords : connecting, remote, database

  1. Free Or Opensource Database/schema Browser?
    Alternatives to TOAD or PL/SQL Developer (6)
  2. How To Understand A Database Schema
    A very nice and simple tutorial (4)
    Yesterday while i'm seaching for a data model and database schema at the Library of Free Data
    Models for a new project of a friend of mine i found there this nice and simple tutorial on How to
    Understand a Database Schema . As its name says, this tutorial will help you to better understand a
    Database Schema and covers the following basics topics that every Database Schema must define:
    QUOTE Primary and Foreign Keys. One-to-Many and Many-to-Many Relationships. Inheritance.
    "Rabbit's Ears", (Recursive relationships). The Scope of this tutorial is ....
  3. Best Database
    (13)
    What is the best free database if some one trying built a social networking website? And how to
    operate it with dreamweaver 8?....
  4. Some Useful Database Links.
    (7)
    I thought I would take a moment to point the users here to some of the database resources available
    for reference and learning. First I will start with actually designing the database. This site by
    R937 covers the basics of database design. The author is professional database guru and a frequent
    helper at the at DB forums listed below. The Library of Free Data Models is an excellent
    resource for finding data models for projects you may have or as examples of well put together data
    models. With around 500 data models the chances are you find something at least cl....
  5. Database Access On Remote Server W/jsp
    (0)
    Hello: I am new to JAVA and server-side applications and have a dumb question. I have set up
    Tomcat on my machine and created a JSP program to query an Access database using a DSN-Less
    connection. If I publish the page to a webserver and include the .MDB file will it work? I'm
    not sure exactly what needs to be packaged with my Java application to make it work. Since I
    don't have a remote server that supports .jsp I cannot really test it. I'm assuming that
    JDBC driver would be bundled with my site but not sure. Thanks!....
  6. Space Needed For Database
    (10)
    Iam assuming the information in the databases i will create will be stored in the 500 MB space i
    get, but since 500MB isn't enough iam wondering if you guys can tell me how much bytes the
    following take: Varchar(x),Tinyint,Text,date,smallint,mediumint,bigint,float.... And the rest
    present when you add/edit a row in a table. Also what are the ranges of tinyint,smallint,mediumint
    and big int....
  7. Mysql Database Entry By Excel Sheets
    (2)
    Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to
    mysql database. Thanks....
  8. Mysql Database Management
    (1)
    Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me
    to understand the first question of the exercise 25.21 of Elmasri-Navath 4th edition? Consider the
    following relations: BOOKS (Book#, Primary_author, Topic, Total_stock, $price) BOOKSTORE (Store#,
    City, State, Zip, Inventory_value) STOCK (Store#, Book#, Qty) Consider a distributed database for a
    bookstore chain called National Books with 3 sites called EAST, MIDDLE, and WEST. Consider that
    BOOKS are fragmented by $price amounts into: B1:BOOK1:up to $20. B2:BOOK2:from ....
  9. Accessing Ms Access Database From A Centralized Location?
    (5)
    Hi I am a manager at a trading/wholesaling company (and have no programming background). I
    customized the Northwind sample access database to make invoices and keep accounts for my company.
    We now opening another office at a distant location. So, the order entry will be done at two
    points(we plan to use the same Access database). I am not able to figure out how to access the same
    MS Access database from two different location(as LAN can't be used). Moreover, we can't
    afford to pay huge sums to the software developers. Can intranet or uploading the database t....
  10. Integrate Access Database Onto Intranet Site
    Looking to integrate access database into my intranet site (5)
    Hey guys, im new here and am looking for answers /tongue.gif" style="vertical-align:middle"
    emoid=":P" border="0" alt="tongue.gif" /> Firstly, i have designed a database using M$ access, it
    consists of multiple forms which i plan to host on an intranet website, i need to be able to add
    records directly from the form on the intranet website aswell as being able to edit/review current
    entries on forms in the database. My question is, how would i go about integrating these forms onto
    the intranet website? i plan on keeping the database and the intranet site on the same d....
  11. Database
    prblem with it (1)
    i have free script but it is working fine on a lot of sites i tried to use it to my web site ....i
    edit its config.php right and but my database name and my user name and password every thing right
    and when i try to install it it gives me this error can`t connect to database please choose file
    from this mobile.sql can any body help plz coz i tried huderd of times and no thing happend....
  12. Need Help In Database Auto_increment
    (9)
    i am creating a game and i set when someone registers than he gets id...in "extra" i have set it to
    be "auto_increment" but whenever new player signs up he gets number bigger than 210...(my first id
    was 211,next was 212,third was 213,fourth got 214) how to set it to go from 1 to infinite? thnx....
  13. My Sql Database Help?
    (3)
    Ok, i am new at web design, i dont know too much about it... I was working on a website for about
    a month this is what i got, My Web , like i said, i dont know much.. i used FrontPage and did all
    of that, my current host is AFMU which uses MySQL, but the way it is set up I dont know how to
    acquire the URL of the database or any information i dont know what it means at all.. i just want to
    do a simple login feature, i mean this is my first website and i am learning so I think it would be
    a great feature to add in and learn. i can create data bases from there but do n....
  14. Database Size?
    So how big is everybody's MySQL database? (10)
    Well I know that MySQL databases can get rather big, so I was just wondering how big everybodies
    databases were? Do you have really big ones, or are they relatively small? Also what do you store in
    them? (just text, or binary data as well)....
  15. How Many Concurrent Users For Oracle Database?
    This is to analyse and get perfect result for How many concurrent use (1)
    Hi friends, How many concurrent users can practically access the oracle database?
    they say tht the figure is hundreds of thousands users...is there any exact figure? or does the
    number of concurrent users depend on any other factors as wel? I think depend on parameter
    1.session 2.processes session Specific connection of a user to an Oracle instance through a user
    process. A session lasts from the time the user connects until the time the user disconnects or
    exits the database application. Multiple sessions can be created and exist concurrently for ....
  16. Database Programming In Vba 6.0
    (1)
    hi , i need some sample program in database.thanks....
  17. Need Info On Database Programming Courses
    Oracle Database Programming (2)
    I know Database Programming on MS-ACCESS, now i am planning to go for some other Database
    Programming courses, People told me to go for Oracle or VisualAge. Can anyone told me to start with
    which one and how long is the course period and which one is easy and is it similar to ms access or
    somthig different.....
  18. Permission Problem With Mysql Database Creation
    Please Help! (8)
    I seem to have a problem with accessing my database with proper permissions. I have set the my
    database correctly giving my db username all priviliges yet i seem to be unable to even log on with
    this username with a denied access error. Any ideas on resolving this?....
  19. Can I Remotely Access Astahost MySQL DBs?
    Remote Ascess??? (11)
    I can Access This MySQL Server using a Software like MySQL-Front?....
  20. Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database
    (4)
    Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a
    good practice to directly store images and other binary files in a MySQL database. Any one with
    help? Thanks....
  21. What Is Maximum Capacity Of Astahost MySQL Database?
    (11)
    I'm sorry about this topic. I'm a new user and my english is not very good. I want to learn
    the max capacity of mysql db.....
  22. Using pbpBB2 And Mediawiki Common Database
    (3)
    I want to host phpbb2 forum and one wiki software (not sure whcih one at this point). Can someone
    help me how to use a common or shared database for both these applications? The user data, login
    could be common on both databases. Any inputs are appreciated. Thanks ....
  23. What Is A Database How Do I Use One?
    : Information about Databases and how to get use them efficiently (7)
    Hello All Let's start off by talking about what a database is and how it would be efficient
    in using it. It wasn't until about a year and half ago now that I was first introduced to this
    new age of Database. I discovered a lot of neat things and even learned about databases the very
    long way. A database is exactly how it sounds its data that has a base. The base being the place
    where you store all your data. If you have ever been to a library perhaps you have used the Index to
    search for an author, this is a database of authors. Ever seen a rolodex on someo....
  24. MySQL Output Database Question
    (18)
    I am new to MySql and have just created a database after using a script. My problem is not the
    script, but what it says about putting it into the output file. I cant figure out the right terms
    to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
    'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
    please help me out?....
  25. Database Program With GUI
    (14)
    I am looking for a program to create SQL databases through a GUI to simplify it, the only things i
    can seem to find are command prompt things and i can't work with them. I like MS access and
    would like something similar to that if possible. I am working with windows at the moment can anyone
    recommend a program i can use (preferably free) Many thanks....
  26. The Best Database
    What do you think is the best database? (48)
    Ive been planning to create a online application which requires tons of stuff from database. Ive
    been using interbase, at first it was good but after a month i find it not user friendly at all...
    Its to hard to code in php.. Can any of you guys give me a good database which is easy to use?....
  27. Mirror My MySQL Database To Another Mysql Server
    (4)
    Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql
    server?or create a small php script to do this? The reason is because, we all know that database is
    very improtant if we have dynamic website. I have my forum hosted and i want to automatically
    mirror this or backup into another mysql server(free). Like in freesql.org. So that im not afraid
    that i forgot to backup my database..also i have one central backup database. Thanks for the
    help..Im looking forward for this posibility.....
  28. Need Advice On Creating Online Music Database
    ps - dont know anything about databases! (6)
    I need to create a database of around 1000 music albums that I can put on my site, with the ability
    to search the database according to several different criteria. Being a complete and total NOOB to
    the world of databases, can anyone point me in the direction of some software that will let me
    create a good-looking and functional database, but that isn't too complicated for me to use?!
    Sounds like a tall order I know, be grateful if anyone can help though. Thanks! Topic edited to
    reflect content better. ....
  29. Embedded Database
    Embedded Data base at client side, (7)
    Hi, Now its the era of Embedded databases, no more db servers, no more host,Because with embedded
    db you can get all those options, what you are used to get with DB Servers. Some of Embedded DB Are
    1) Cloudscape From IBM (NOW Derby from ASF) 2) HSQLDB (OpenSource) and many more Feel the power of
    EDB Cheers Arunkumar.H.G....
  30. phpBB Database Transfer
    Anyone here knows how to? (10)
    Hello, i'm a newbie in using phpBB and I still lack knowledge in mySQL database. How do I
    transfer the datas(users,configs, all of them) contained in my current forum to another one in
    phpBB? I hope someone can help, a short but detailed tutorial would be good. Example is, if I want
    to move to a new host and I want to transfer all the accounts on my old forum to the new one. Thanks
    in advance, hope anyone here knows how to.....

    1. Looking for connecting, remote, database






*SIMILAR VIDEOS*
Searching Video's for connecting, remote, database
Similar
Free Or Opensource Database/schema Browser? - Alternatives to TOAD or PL/SQL Developer
How To Understand A Database Schema - A very nice and simple tutorial
Best Database
Some Useful Database Links.
Database Access On Remote Server W/jsp
Space Needed For Database
Mysql Database Entry By Excel Sheets
Mysql Database Management
Accessing Ms Access Database From A Centralized Location?
Integrate Access Database Onto Intranet Site - Looking to integrate access database into my intranet site
Database - prblem with it
Need Help In Database Auto_increment
My Sql Database Help?
Database Size? - So how big is everybody's MySQL database?
How Many Concurrent Users For Oracle Database? - This is to analyse and get perfect result for How many concurrent use
Database Programming In Vba 6.0
Need Info On Database Programming Courses - Oracle Database Programming
Permission Problem With Mysql Database Creation - Please Help!
Can I Remotely Access Astahost MySQL DBs? - Remote Ascess???
Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database
What Is Maximum Capacity Of Astahost MySQL Database?
Using pbpBB2 And Mediawiki Common Database
What Is A Database How Do I Use One? - : Information about Databases and how to get use them efficiently
MySQL Output Database Question
Database Program With GUI
The Best Database - What do you think is the best database?
Mirror My MySQL Database To Another Mysql Server
Need Advice On Creating Online Music Database - ps - dont know anything about databases!
Embedded Database - Embedded Data base at client side,
phpBB Database Transfer - Anyone here knows how to?
advertisement




Connecting To A Remote Database



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE