db

2013-08-06 18:48 来源:www.chinab4c.com 作者:admin

  long mmm = System.currentTimeMillis();

MysqlDb x = new MysqlDb("icmall","root","123456","172.168.16.23");
PreparedStatement ps = x.prepare("select goods_id,goods_name,cat_id,brand_id,provider_name from ecs_goods where goods_name=?");
ps.setString(1,"V24A12T400BG3");
//ps.setString(2,"300000");
ResultSet res = ps.executeQuery();
res.next();
System.out.println(res.getString("goods_id"));
System.out.println(System.currentTimeMillis()-mmm);
 
long mmm1 = System.currentTimeMillis();
Mongodb mg = new Mongodb("dbname","system","system","127.0.0.1");
DB      db = mg.selectDB("test");
DBCollection goods = db.getCollection("goods");
DBCursor  c = goods.find(new BasicDBObject("goods_name","V24A12T400BG3"));
System.out.println(c.next().get("goods_id"));
System.out.println(System.currentTimeMillis()-mmm1);