We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › MySQL and Processing Integration
Page Index Toggle Pages: 1
MySQL and Processing Integration (Read 3242 times)
MySQL and Processing Integration
Nov 6th, 2007, 11:02am
 
Hello

I already saw this kind of problem in many posts but I couldnt figure out how to solve it.

I have a Processing applet connecting using mysql library from Florian Jenett and it works excellent locally. when I export my applet and put it online tha applet cannot connet to database. I already found out that applet cannot connect directly to databases. But I dont find a way to sucessfully connect do db.

Could someone please help me? I'm not very experiencied to processing and have to have this applet running as soon as possible! I'm DESPERATE!
Re: MySQL and Processing Integration
Reply #1 - Nov 6th, 2007, 11:45am
 
see here (applet part):
http://bezier.de/mysql/#NOTES

how much data do you need to load?
if it's just smaller pieces try tunneling thru php:

applet (browser/client) -> php (server) -> mysql (server) -> php -> applet

see here for an example:
http://www.processinghacks.com/hacks/sql?s=mysql

can you describe your project a little?

F
Re: MySQL and Processing Integration
Reply #2 - Nov 6th, 2007, 11:58am
 
my project is an encyclopedia online whose contents are given by users.
it's very simple. all it does is an query for display tha data in the db, a query for a search engine and a query when users write new material for the application.
i have everything working up and now i don't know waht to do because i'm very rookie and this is for my final work to college. so i'm desperate.

the data to load is only text elements. is not many things. it's a light db.

in the php situation i don't have very experience in php so i don't know how to do it. =( i made php pages in dreamweaver that can read and display mysql data but i don't know how to integrate with processing.

thanks
Re: MySQL and Processing Integration
Reply #3 - Nov 25th, 2007, 10:15am
 
sorry, just realized i missed to answer your last post. are you still working on the project?

F
Re: MySQL and Processing Integration
Reply #4 - Nov 25th, 2007, 12:28pm
 
that's ok. i've already got the answer! thanks anyway =)
Re: MySQL and Processing Integration
Reply #5 - Dec 16th, 2008, 2:10am
 
I hope this is still being read, as I have this very question.

My scenario:
I have a MySQL database with some data. I have written a PHP script that returns the table data I want, in the browser, as text. Now, I want to use this data in Processing, but am unable to find a solution.

I have read previous posts about using the SQL Libraries (Bezier), but my project could be in a situation where abuse could happen, so I want to avoid my database login info being stolen from decompilers.

I have also read another post about using PHP, but was unsuccessful.

If someone could give me some insight on the Processing /PHP script combo for reading my table data, that would be great! I can provide my PHP script as well if needed. Thanks!
Re: MySQL and Processing Integration
Reply #6 - Dec 16th, 2008, 8:25am
 
processing loads the contents of the page (html) with loadStrings("http://myserver.dd/foobar.php?thisissome=value").

the trick is to have php produce a nicely structured output, so you can parse it easily in processing. if your data is complex consider using xml otherwise try newlines and commas or tabs.

String[] html = loadStrings( <path/to/phpscript> );
for ( int i = 0; i < html.length; i++ )
{
 // do something, for example store the data in another variable
 // for later use.
}

F
Re: MySQL and Processing Integration
Reply #7 - Dec 17th, 2008, 3:57pm
 
Thanks fjen, I think this will help greatly. I will check this out and post my progress.
Page Index Toggle Pages: 1