473,378 Members | 1,436 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,378 software developers and data experts.

Connecting to local database from Internet

I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web site http://www.internet.com to run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.

Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...

<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>

May 17 '07 #1
8 3819
mo*****@yahoo.com wrote:
I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web site http://www.internet.com to run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.

Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...

<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>
PHP runs on the server, not the client. So if your webserver with PHP is
on the same machine (or LAN) as your database server, there should be no
problem at all.

Storing data locally through a web browser is a bit more tricky though.
If you use certificates the client trusts, it should work. Otherwise,
the website might be considered a security problem (like the ones that
stoer trojans on your PC)...
--
Sabine Dinis Blochberger

Op3racional
www.op3racional.eu
May 17 '07 #2
mo*****@yahoo.com wrote:
I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web site http://www.internet.com to run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.

Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...

<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>
As Sabine indicated, php runs on the server, so 'localhost' will always
be the server's database.

In addition, you shouldn't plan to store data in the client's database.
Most people don't have MySQL installed. Most of those who do have it
installed on their local machine either have network connections
disabled or have a firewall which prevents external access. And those
who do allow external access are not likely to give out a
userid/password to another website - at least not if they have any sense
at all. And even if they give you their userid and password, you don't
know if they have the appropriate database and tables - or maybe have
that database and table name for an entirely different use.

I don't know what kind of data you're storing, but I don't think this is
a good way to go.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 17 '07 #3
You would need to have a static IP first of all. Then you might need
to set up port forwarding if you have any sort of firewall. But then
you would just connect to that IP/Port just like you would if you were
on the same server

May 17 '07 #4
On May 17, 5:53 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
moua...@yahoo.com wrote:
I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web sitehttp://www.internet.comto run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.
Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...
<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>

As Sabine indicated, php runs on the server, so 'localhost' will always
be the server's database.

In addition, you shouldn't plan to store data in the client's database.
Most people don't have MySQL installed. Most of those who do have it
installed on their local machine either have network connections
disabled or have a firewall which prevents external access. And those
who do allow external access are not likely to give out a
userid/password to another website - at least not if they have any sense
at all. And even if they give you their userid and password, you don't
know if they have the appropriate database and tables - or maybe have
that database and table name for an entirely different use.

I don't know what kind of data you're storing, but I don't think this is
a good way to go.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -
I was expecting there would be firewall and security issues. It just
looks so simple thought I'd just give it a shot.
I would let the users know that if they want to store the data locally
they would have to have MySQL installed with a specified database
name, user, and password. Then provide a script to create the table
structure.
I was hoping this would be possible so the user wouldn't need to have
PHP and a web server installed. All they would need is just the
database. Now it looks like the user will need PHP, web server, and
MySQL. The user will download a PHP file and run it on their web
server. The PHP page will have links to include files from my web
site. I think it should work this way, right? No security or
firewall issues? Only issue here with me is that I run the risk of
users modifying my PHP and javascript codes. I want to control the
app from my web site so that if I make changes everyone will get the
update, even the ones who run the app locally.

BTW, I'm developing a financial app so the database will have
financial information about the user. Most people including myself
are protective of financial information.

May 17 '07 #5
mo*****@yahoo.com wrote:
I would let the users know that if they want to store the data locally
they would have to have MySQL installed with a specified database
name, user, and password. Then provide a script to create the table
structure.
PHP on your server is not way to do this. At all. Use downloadable
java application instead.
May be this is will be possible when IPv6 will be common.
May 17 '07 #6
>Now it looks like the user will need PHP, web server, and
>MySQL. The user will download a PHP file and run it on their web
server. The PHP page will have links to include files from my web
site.
If you expect users to run PHP on their system with off-site include
files, either you're nuts, or your users are nuts. Especially when the
application deals with financial data.
>I think it should work this way, right? No security or
firewall issues?
Including a PHP file from a site you (the guy running the site, in this
case, your customer) don't own is really, REALLY asking for trouble.
>Only issue here with me is that I run the risk of
users modifying my PHP and javascript codes. I want to control the
app from my web site so that if I make changes everyone will get the
update, even the ones who run the app locally.
So if your site gets infected, so do all your customers. Or if
your DNS gets spoofed somehow so the customer sites go elsewhere
for the include files.
>BTW, I'm developing a financial app so the database will have
financial information about the user. Most people including myself
are protective of financial information.
People who are protective of financial information should have run away
screaming halfway through this article.

May 18 '07 #7
mo*****@yahoo.com wrote:
On May 17, 5:53 am, Jerry Stuckle <jstuck...@attglobal.netwrote:
>moua...@yahoo.com wrote:
>>I'm not sure if this is possible. I would like to have a PHP app on
the Internet connect and write to a local database (Intranet). For
example, users would go to a web sitehttp://www.internet.comto run
the app. The app requires an internet connection and is outside of
the user's network. The app would have the option to either store
data locally or on the Internet. I would like to give users the
option to store data locally because some may have privacy/security
concerns if the data is stored on the Internet or kept/maintained by
another company.
Would the connection string below work from the Internet to connect to
the user's local database? I don't have my web hosting service up yet
so I can't test. Thanks...
<?php
$server='localhost' //or whatever the client db server name is
$c=new mysqli($server,'user','passwd','db');
?>
As Sabine indicated, php runs on the server, so 'localhost' will always
be the server's database.

In addition, you shouldn't plan to store data in the client's database.
Most people don't have MySQL installed. Most of those who do have it
installed on their local machine either have network connections
disabled or have a firewall which prevents external access. And those
who do allow external access are not likely to give out a
userid/password to another website - at least not if they have any sense
at all. And even if they give you their userid and password, you don't
know if they have the appropriate database and tables - or maybe have
that database and table name for an entirely different use.

I don't know what kind of data you're storing, but I don't think this is
a good way to go.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

I was expecting there would be firewall and security issues. It just
looks so simple thought I'd just give it a shot.
I would let the users know that if they want to store the data locally
they would have to have MySQL installed with a specified database
name, user, and password. Then provide a script to create the table
structure.
I was hoping this would be possible so the user wouldn't need to have
PHP and a web server installed. All they would need is just the
database. Now it looks like the user will need PHP, web server, and
MySQL. The user will download a PHP file and run it on their web
server. The PHP page will have links to include files from my web
site. I think it should work this way, right? No security or
firewall issues? Only issue here with me is that I run the risk of
users modifying my PHP and javascript codes. I want to control the
app from my web site so that if I make changes everyone will get the
update, even the ones who run the app locally.

BTW, I'm developing a financial app so the database will have
financial information about the user. Most people including myself
are protective of financial information.
I agree with Gordon's comments. If you want them to store the data on
their local system, give them an encrypted file to store it in. Next
time they access your system, they can upload the encrypted file, which
you can then parse.

But your idea is a recipe for failure.

And no, you do not want or need a java application. In fact, java won't
help you a bit here. Java, due to security restrictions, can't store on
the client machine, either. It can only store back to the server.

And as for downloading java applications - the same caveats Gordon
mentioned for PHP apply to Java.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 18 '07 #8
mouac01 wrote:
I was hoping this would be possible so the user wouldn't need to have
PHP and a web server installed. All they would need is just the
database.
Yes, that is certainly possible.

It would be a triumph of ingenuity over sanity.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
May 18 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
0
by: ds | last post by:
i have a remote local machine with sql database.i have to connect to the local machine and copy the databse and put on the database which is running no the internet using dotnet.how to do.
1
by: Dishaa V | last post by:
Hello I need to connect to an access db which is on the internet. I do know that URL of the same. its http://www.vallury.com/balance/bank.mdb. Its just a test db. How can I connect to that db...
3
by: GTDriver | last post by:
I'm trying to connect my application with a web service located on my own web server(localhost). I guess when the solution/proect is built it makes a file called 'Web...
14
by: Peter | last post by:
I am trying to connect to a DB2 database with IBM.Data.DB2 provider and getting the following message ERROR SQL30081N A communication error has been detected. Communication protocol being...
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
5
by: Odd Bjørn Andersen | last post by:
I have installed DB2 9 Enterprise Edition on my laptop and created the sample database. Now I'm having truble connecting to the database from Command Editor. If I connect from Command Window it's...
2
by: steve | last post by:
Hi All Has anybody had experience connecting to SQL server 2005 on a remote site via VPN A client has a warehouse in each capital city in Australia and wants to have them all record sales etc...
1
by: peggitt | last post by:
I need help. I need code to connect my java program with a mysql database hosted by an internet service provider(domain). The java program should run locally but read and write to a database on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.