In this case, I assume you want both, dynamic interactivity and pull large datasets from a database in real time. This can be done with a CDF
notebook, and it doesn't require WebMathematica unless your notebook really needs to do much more computationally intensive work than your example code indicates.
So here are the steps:
Server
Save your dynamic notebook as a CDF
in a directory on your web server where you have enabled serving CDF
- i.e., by adding the following to your .htaccess
file:
AddType application/vnd.wolfram.player nbp
AddType application/vnd.wolfram.mathematica nb
AddType application/vnd.wolfram.cdf cdf
AddType application/vnd.wolfram.cdf.text cdf
Then save your data file (let's call it data.txt
) somewhere on your server, too. I'll assume the URL
of the data file is http://website.com/data.txt
.
Your notebook
In your CDF
file, read the contents of the required data file(s) using a statement like fileContents = Import["http://website.com/data.txt"];
That's all there is to it. Now you can manipulate the contents of data.txt on the client side, and update its contents on the server side if necessary.