473,405 Members | 2,334 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,405 software developers and data experts.

cacheing (is that a word) remote data in browser

Right...have loads of C++, SQLServer experience but about 5 minutes of
JavaScript, ASP etc.

Spent a frustrating 2 days deciding the best way to get some data from
a SQL database, then cached in the browser so it could be used by a
number of pages without repeated database querying. No idea which is
the most current v obsolete technology.

Remote scripting seemed feasible but is this on the way out. Tried
implementing it but got some java file access denied issues - "access
denied (java.io.FilePermission
C:\Inetpub\wwwroot\RemoteScriptTest\rev.asp?_metho d=GetServerProxy&_mtype=execute&pcount=0
read)" that left me stumped.

My simple plan was to get a chunk of data from a database, presumably
using ASP. This would then be stored in some local array to be accessed
at leisure by client side Javascript. Am I missing the point. Is this
impossible?

Humph

Jul 23 '05 #1
3 1353

Yes, you do it by passing an Array object with your data in it to js,
globally(outside any function blocks), then you load it in each page. The
simplest way will be to give the page an include of a .js <script
type="text/javascript" src="MYARRAY.js"></script> or such, so the .js file
is fetched/loaded in the page, as for MYARRAY.js to get all the correct
values from the SQL query, the easiest way will be to use server side
language to do the query ONCE, and 'printf' or 'echo' or 'cat' or output
the stdout to a text file and name it MYARRAY.js or such, with the output,
for example, in PHP you'd do something like:

<?php
$setFile=fopen("MYARRAY.js","w");
fwrite($setFile,'<script type="text\/javascript"> \n\r
myArray=new Array();\n\r');
$OUTPUT_SQL_RESULTS_IN_ARRAY=SOME_METHOD_TO_RUN_TH E_QUERY_AND_OUTPUT_RESULTS();
foreach ($OUTPUT_SQL_RESULTS_IN_ARRAY as $name=>$content) {
$current="myArray[$OUTPUT_SQL_RESULTS_IN_ARRAY[$name]=$content;
\n\r";
fwrite($setFile,$current);
}

------------ ^ which is pretty much a For In loop -----------
or just use a sequential For loop

for (i=0;i<count($OUTPUT_SQL_RESULTS_IN_ARRAY);i++) {
/* then the fwrite() to the file here, pretty much
just appending the js code for it be parsed on the
client */
}
?>

Danny

On Sun, 05 Jun 2005 11:48:09 -0700, tisgrim <gw*****@blueyonder.co.uk>
wrote:
Right...have loads of C++, SQLServer experience but about 5 minutes of
JavaScript, ASP etc.

Spent a frustrating 2 days deciding the best way to get some data from
a SQL database, then cached in the browser so it could be used by a
number of pages without repeated database querying. No idea which is
the most current v obsolete technology.

Remote scripting seemed feasible but is this on the way out. Tried
implementing it but got some java file access denied issues - "access
denied (java.io.FilePermission
C:\Inetpub\wwwroot\RemoteScriptTest\rev.asp?_metho d=GetServerProxy&_mtype=execute&pcount=0
read)" that left me stumped.

My simple plan was to get a chunk of data from a database, presumably
using ASP. This would then be stored in some local array to be accessed
at leisure by client side Javascript. Am I missing the point. Is this
impossible?

Humph


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #2
VK
If SQL data must be unique for each user session, then you have three
options to choose from:

1. Set session cookie. It holds up to 1Kb guaranteed. So unless you
have some MEMO fields like Full_Story_Of_My_Life, it should be fair
enough for anything.

2. Use the shame of frames (pls don't)

3. Create server-side session .js files and then
<script src="id0u3u4ud9g7j4.js"></script>
It raises the questions though 1) of server clean up after and 2)
possible privacy exposure via cache (fixable but extra headache).

Tell me what you like the most.

Jul 23 '05 #3
wl
"VK" <sc**********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
If SQL data must be unique for each user session, then you have three
options to choose from:

1. Set session cookie. It holds up to 1Kb guaranteed. So unless you
have some MEMO fields like Full_Story_Of_My_Life, it should be fair
enough for anything.

2. Use the shame of frames (pls don't)

3. Create server-side session .js files and then
<script src="id0u3u4ud9g7j4.js"></script>
It raises the questions though 1) of server clean up after and 2)
possible privacy exposure via cache (fixable but extra headache).

Tell me what you like the most.


As a remark on option 3: instead of using "<script src="....js">" you
can also refer to a serverside URL (ASP, ASP.NET, JSP, ...) that return
the

JavaScript code. No problem on cleaning up the .js file afterwards then.

Wim
Jul 23 '05 #4

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

Similar topics

3
by: Mark Bergman | last post by:
We have inherited a script which runs rsh (remote shell), taking parameters from a variable, and if attempting to run a multi-word command remotely, we get an error! See the example below which...
2
by: Johann Blake | last post by:
If you are, I'd be interested in knowing what kinds of applications you are working on and the problems, if any, you are confronting. Best Regards, Johann Blake CloserWorlds Mobile Solutions...
3
by: Daniel | last post by:
Hi, I have opened the word file from database and display in web browser. When i close the browser, i wan to update the changes into the database. and i dont know how to achieve it. I oni know...
1
by: Franck | last post by:
Hi, Tryin to open a generated word doc with Word and not in IE. Lookin samples, I tried this without success : Response.ContentType = "application/ms-word"...
1
ANTY90
by: ANTY90 | last post by:
Can I use Remote Data control to connect VB to Oracle which is existing on my own system? If yes, how?
5
by: shuvo2k6 | last post by:
Hi, I am working on Remote Data Object (RDO) & MySQL in VB6. I cann't add record in my table. If anybody have Solution, Plz send me. Regards, shuvo2k6
2
by: trivenisri | last post by:
Hi, I am triveni.Can any one know about 'How to open a MS Word document from Javascript in mozilla browser'.I am able to open in IE.Please help me about this issue. Regards, Triveni
0
by: SnehaAgrawal | last post by:
Hi see if u could help me with the following I am accessing a table which is on another DB. But when I write Select LinkNo from ServerName.DBName.dbo.LinkMaster with(XLOck) where Linkid=25 It...
0
by: adititiwari | last post by:
Hi, I issued a command: create server p400 type db2/400 version 5.3.0 wrapper DRDA authorization "qseibm" password "ibm***" options (node 'S657686B', dbname 'S657686B') for an already...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.