//connect to the bezier library
import de.bezier.data.sql.*;
MySQL mysql;
void setup()
{
size(100,100);
//use your own username ,password and your own database
String user="hui1570";
String pass="04263028";
String database="mydatas";
//connect to MySQL
mysql=new MySQL(this,"localhost",database,user,pass);
if(mysql.connect())
{
//the statement of querying
mysql.query("SELECT COUNT(*) from user");
//I don't know ??????
mysql.next();
//I am not sure whether we must use 1 in getInt()
//int num=mysql.getInt(1);
println("number of rows:"+mysql.getInt(1));
}
else
{
println("connection failed!");
}
}
//void draw()
//{
//
//}
processing - MySQL example1-conntction(), query() , next() , getInt(1)
最新推荐文章于 2021-02-18 04:17:39 发布