LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-06-2009, 02:41 AM   #1
fcdev
Member
 
Registered: Sep 2005
Posts: 47

Rep: Reputation: 15
HTML/Javascript - Can I access a user's local SQL server (with their permission)


This is an odd one, I know ...

My company uses a private database-driven web site to manage most of our administrative duties, but due to the huge amount of data available on one screen, it is becoming unmanageable for some off-site staff on slow Internet connections.

We use PHP to generate the pages, but that's server-side scripting, and we need to avoid pulling this information from the server.

One solution we have discussed is for the users of the site to install MySQL on their own machines, and keep a cached copy of that table locally (that table only updates about once a month, but it's HUGE).

So, what I'm asking is ...

Can my web page pull data off the viewer's SQL server, using client-side processing (Javascript, or something like that)?

I have looked into other options, like training the users to download this table as a text file, and typing in a ID number for the entry they need ... but that idea went down like a lead balloon.

Any suggestions would be greatly appreciated.

- Stephen Fraser
 
Old 09-06-2009, 04:11 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
As far as I am aware JavaScript doesn't have any SQL support. It does have support for reading files so maybe you could write a script to read the table information from a local file. You problem is then to get the database into a file format, which you suggested that you have already considered. However rather than one file which may be slow you may want to consider breaking it down into smaller files, with the name indicating the ID range.
 
Old 09-06-2009, 01:45 PM   #3
fcdev
Member
 
Registered: Sep 2005
Posts: 47

Original Poster
Rep: Reputation: 15
Actually, that's not such a bad idea ... I could convert the table into a file or series of files, and have people download new copies when their version becomes out of date. I'll look into that/ Thanks for the advise
 
Old 09-06-2009, 07:02 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I understand that the speed becomes a problem if there is a slow connection between the server and the client?

If you are able to install MySQL + database on the client's machines, can't you install the entire database + application + web server? The database will be by far the largest. Is I take it, copying once in a while is an option.

I have a large application running on LAMP. When I travel and I want to develop the application I simple copy the database and scripts, everything else I have running, and it is like I am at home.

If the scripts were written to connect to the database on 'localhost' you'd be fine, otherwise the developers built in a configuration option to point to localhost as this is what you will be using on your client.

Copying tables or databases is a breeze with MySQL. You could even think of more sophisticated synchronization schemes.

jlinkels
 
Old 09-06-2009, 09:05 PM   #5
fcdev
Member
 
Registered: Sep 2005
Posts: 47

Original Poster
Rep: Reputation: 15
"If you are able to install MySQL + database on the client's machines..."

Yes, that was one thing I thought very carefully about ... but ruled that out as an option because every other table changes very rapidly (and the remote users are constantly creating new data), and we don't want to have synchronisation problems. Also, the web application itself is undergoing constant upgrades (I am employed full time to provide 'continual improvement'), and the remote users are not the sort of people who would be able to upload updates to a web server, and considering the distances between us, they don't bring they're machines into the main office very often *maybe once every 6 months).

As for the suggestion of storing the file locally, I have tried that out, and so far, the browser is either loading the file as a blank, or saying the file does not exist. Since we use Windows, Mac, and Linux (hosting on Linux), ActiveX is not an option. I found this link ... http://snipplr.com/view/4021/read-lo...mlhttprequest/ but it's saying the file is not found ... I tried placing the file I want in my home folder, and also in the root folder of the file system, and another copy in the /var/www folder, and it didn't find any of them.

Some web sites have suggested using a Java applet as a download assistant, but I haven't seen any examples of this as yet (I'm not really a Java / Javascript expert).
 
Old 09-07-2009, 03:08 AM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Sorry my mistake, the reading of files within JavaScript is limited for security reasons. My thoughts are you could look at another scripting language, which would complicate the install issue or, maybe the php.js project
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
403 forbidden :You don't have permission to access /hi.html on this server. av.dubey Linux - Newbie 3 12-21-2007 12:10 AM
"Forbidden / You don't have permission to access /~user/index.html on this server." honglin_8 Linux - Newbie 8 10-30-2007 08:41 AM
how can I download (back up) sql database on the linux server to my local computer? jenny1668 Linux - General 5 07-15-2006 01:50 AM
403 You don't have permission to access /index.html on this server. xpucto Linux - Networking 6 06-06-2006 09:19 AM
Massive SQL dump without local access. xconspirisist Linux - General 1 01-30-2005 10:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration