In the PostgreSQL example for the SQLibrary ( http://bezier.de/processing/libs/sql/ ), it says that the example only works if the DB is on the local network. I can't seem to find anything in the documentation that suggests a way to differentiate the code to facilitate a remote-connection away from the local network.
Does anyone know if this can be done, or how?
// updated fjenett 20081129
size( 100, 100 );
// this example assumes that you are running the
// postgresql server locally (on "localhost").
// replace with your own postgresql-account.
String user = "fjenett";
String pass = "fjenett";
// name of the database to use
String database = "test";
// connect to database on "localhost"
pgsql = new PostgreSQL( this, "localhost", database, user, pass );
if ( pgsql.connect() )
// query the number of entries in table "weather"
pgsql.query( "SELECT COUNT(*) FROM weather" );
// results found?
if ( pgsql.next() )
// nice, then let's report them back
println( "number of rows in table weather: " + pgsql.getInt(1) );
// now let's query for last 10 entries in "weather"
It must have been an issue with my router at the location I first tried this from. Tried it again, and it worked. I did get some connection errors initially, but that must have been a DB response time issue because it started pumping out the data shortly afterwards. Fired it up a second time, and no hiccup at all.
Leave a comment on kaihansen79's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic