processing - MySQL example1-conntction(), query() , next() , getInt(1)

来源:互联网 发布:闲杂软件 编辑:程序博客网 时间:2024/04/29 17:25

//connect to the bezier libraryimport 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()//{//  //}


0 0