首页>代码>java访问sqlite数据库>/1260278093349888.java
import java.sql.Connection;  
import java.sql.DriverManager;  
import java.sql.ResultSet;  
import java.sql.SQLException;  
import java.sql.Statement;  
  
public class SqliteTest {  
    public static void main(String[] args) {  
        Connection conn = null;  
        try {  
            Class.forName("org.sqlite.JDBC");  
            conn = DriverManager.getConnection("jdbc:sqlite:mydb.db");  
            Statement stmt = conn.createStatement();  
            ResultSet rs = stmt.executeQuery("select * from aa");  
            while(rs.next()){  
                String id = rs.getString(1);  
                System.out.println("用户名:" + id );  
            }  
            rs.close();  
            stmt.close();  
            conn.close();  
        } catch (ClassNotFoundException e) {  
            // TODO Auto-generated catch block  
            e.printStackTrace();  
        } catch (SQLException e) {  
            // TODO Auto-generated catch block  
            e.printStackTrace();  
        }  
    }  
}  
最近下载更多
breakCY  LV15 2021年2月26日
哈哈zr  LV11 2020年5月5日
bypzuidaima  LV2 2019年11月20日
XHacker  LV9 2018年12月24日
ttttttttttttttt  LV7 2018年11月24日
Cielo2018  LV3 2018年4月18日
lingluo75952  LV6 2016年12月26日
ljc520313  LV22 2016年2月14日
gbload  LV1 2016年1月15日
文字青年  LV4 2015年11月30日
最近浏览更多
ming_123_9715  LV23 2022年12月8日
litchi955  LV11 2022年6月1日
梦本是很好的啦  LV11 2021年11月22日
breakCY  LV15 2021年2月26日
xiongfan  LV6 2021年2月22日
zhujianlin 2020年10月24日
暂无贡献等级
daiyou123 2020年7月8日
暂无贡献等级
IT达人  LV22 2020年6月9日
362654892 2020年5月7日
暂无贡献等级
哈哈zr  LV11 2020年5月5日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友