前端之家收集整理的这篇文章主要介绍了
SQLite3之补充,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
package pratice; import java.
sql.Connection; import java.
sql.DriverManager; import java.
sql.ResultSet; import java.
sql.
sqlException; import java.
sql.Statement; public class Link { public static void main(String[] args) { // TODO Auto-generated method stub lian(); } public static void lian(){ String str="select * from man where cid>9999"; try { Class.forName("org.
sqlite.JDBC"); Connection conn=DriverManager.getConnection("jdbc:
sqlite:D:\\android\\db\\people.db"); Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(str); while(rs.next()){ System.out.println("名字:"+rs.getString(3)+",年龄:"+rs.getString(2)+",性别:"+rs.getString(4)); } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (
sqlException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
原文链接:https://www.f2er.com/sqlite/198843.html