Loading...
Logo
Processing Forum
Hi,

With processing no problem to connect and query a database (mySQL, Oracle), but is it possible with processing.js ? I failed !
Thank you for your advices



Replies(5)

Moved to correct section...

Answer: No. And Yes!
Explanation: No, you cannot connect directly to a database.
Yes, you can access data from the database. But you need  a server side script that would do the connection and expose the data via a Web service, accessible eg. with loadStrings().


When you say NO, is it NEVER or may be in few months ?
When you say YES, I am  not strong enough to understand. A example somewhere ?

Thank you phi.lho.
Probably never...

An example of the yes: when a Processing sketch (no PJS) access some Twitter messages via a simple URL, this means a Twitter server made a database access, processed the results, and send them back to the client, in a formated way (raw test, CSV, Json, XML, etc.). This can be done by your own script (eg. in PHP) running on your own server, accessing your database.
Mmm, I think all depends on what kind of database you are thinking on... Does it have any public API? A graphical HTML interface you could use to retrieve the information? Is it a pure MySQL database? 

In case you don´t know next resources, I ´d suggest to read them thoroughly, they are pretty neat. You can see here how to blend PHP and processing or processingjs. Then, as phi.lho says you only have to create the PHP script that will do all the job for you. There are lot of tutorials out there on this specific topic (mySQL queries using PHP).

Daniel Shiffman´s "Processing and PHP"
Daniel Shiffman´s "Processing and PHP persistence"
Pomax´s guide to processingjs*:  
http://processingjs.nihongoresources.com/processing%20on%20the%20web/ 


*: Pomax deserves some kind of digital monument, I´ve to say:  his tutorials are a gift

I knew phi.lho was a "killer".
And you Ale are a "killer" too.
Thank you for your advices. The Poamx's guide seems to be promising. I must take time to digest it.
Bon week-end.