Using data from MySQL via ODBC
Posted: Tue Nov 02, 2010 3:07 pm
Hi all,
I'm having troubles trying to use data from MySql database into Powerswitch 8.
I had been able to establish a good connection ("Database connection succes") to my MySql database [cfr also Zegwaard 2008-06-13 07:18:00 ]
But I'm not able to use data from database!
I always get from the captured log (s.log(1,dbStat))
[object Database8::Statement]
... not so enought useful for me!
here the script
function jobArrived( s : Switch, job : Job )
{
dbConn = new DataSource();
dbConn.connect("mysql","root","mysql");
if ( dbConn.isConnected() )
{
s.log(1,"Database connection succes");
}
else
{
s.log(1,"Database connection error");
}
dbStat = new Statement(dbConn);
dbStat.execute("SELECT * FROM prima WHERE uno = '11'");
s.log(1,dbStat);
var name = dbStat;
var theName = job.getName();
var newname = name + " - " + theName;
dbConn.disconnect();
job.sendToSingle( job.getPath(),newname );
}
So while my input file is "night_test_15.pdf" my output always appear as "Statement] - night_test_158.pdf".
Can anybody help me
ie where can I find scripting examples regarding managing data from database.
many thanks to all
mario
(Original post by Mario, G. Canale & C. S.p.A.)
I'm having troubles trying to use data from MySql database into Powerswitch 8.
I had been able to establish a good connection ("Database connection succes") to my MySql database [cfr also Zegwaard 2008-06-13 07:18:00 ]
But I'm not able to use data from database!
I always get from the captured log (s.log(1,dbStat))
[object Database8::Statement]
... not so enought useful for me!
here the script
function jobArrived( s : Switch, job : Job )
{
dbConn = new DataSource();
dbConn.connect("mysql","root","mysql");
if ( dbConn.isConnected() )
{
s.log(1,"Database connection succes");
}
else
{
s.log(1,"Database connection error");
}
dbStat = new Statement(dbConn);
dbStat.execute("SELECT * FROM prima WHERE uno = '11'");
s.log(1,dbStat);
var name = dbStat;
var theName = job.getName();
var newname = name + " - " + theName;
dbConn.disconnect();
job.sendToSingle( job.getPath(),newname );
}
So while my input file is "night_test_15.pdf" my output always appear as "Statement] - night_test_158.pdf".
Can anybody help me
ie where can I find scripting examples regarding managing data from database.
many thanks to all
mario
(Original post by Mario, G. Canale & C. S.p.A.)