473,289 Members | 1,810 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,289 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 3812
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.