日期:2014-05-16 浏览次数:20606 次
Class.forName("com.mongodb.jdbc.MongoDriver"); Connection c = DriverManager .getConnection("mongodb://192.168.44.129/yangtest"); PreparedStatement st = (c.prepareStatement("select * from blogposts where num > ? and tags=?"); st.setInt(1,1); st.setString(2,"fun"); ResultSet res = st.executeQuery(); while (res.next()) { System.out.println(res.getString("num")); }