You might want to take a look at this for ideas:
I would probably prefer an approach of having a wrapper script (in Java, VBScript, Python, Perl, Applescript) that handled the DB interaction and then feed the data to ExtendScript using the Adobe app's COM (e.g. VBScript) or Applescript APIs. Keeps your ExtendScript simpler this way.
Would you be able to post an example snippet in either AS or VB that feeds data to JSX ?
I haven't had the need to pass data myself, but this SO post gives example of how to do so with Applescript and VBScript (separate answers for each language):
this SO post was referenced in my answer in the previous SO post link.
To summarize, it would be best you externalize your ExtendScript code into a JSX file and run the JSX file from Applescript/VB, that way you don't have to escape the ExtendScript code & can test each part independently if modularlized correctly. And when passing data, you could wrap a "main" method in the JSX file that will take the arguments/parameters passed from Applescript/VB and process accordingly.
This might sound like a hassle, but the other options given in the 1st SO post aren't really any easier to implement. This suggested approach minimizes the amount of layers and intermediary communications (create web service then call it from ExtendScript via HTTP, storing DB data in CSV/text file first, etc.) between the languages.
Hope this helps.
I will read this link when I get a good moment this day, however, using text files was actually my first thought.
Thank you, as for wrapping the module jsx files, from the post I can assume that the following would work?
tell application "Adobe Illustrator"
Or something like that, if I didn't do the quotes right.
Yes, you are on the right track. If you need to pass arguments though, you need to have a method in myRealJSX.jsx that takes arguments and then call that method after including the script before the end alert, passing in the arguments Applescript style (or using string concatenation of static text with variables containing the arguments). The SO post has more details. If you put the value you want to return at the end of the JSX file (e.g. "myValueToReturn;") it will be returned to Applescript, theoretically. No need to add a return statement.
If you are considering the text file approach, then you should probably dump your DB recordset as CSV file then read the file from JSX, dumping the DB data from another language (Java, etc. not sure about Applescript).