当前位置: 首页 > news >正文

运维知识点-Sqlite

在这里插入图片描述

Sqlite

  • 引入 依赖

引入 依赖

            <dependency><groupId>org.xerial</groupId><artifactId>sqlite-jdbc</artifactId><version>3.36.0.3</version></dependency>
import javafx.scene.control.Alert;
import java.sql.*;public class DbUtil {private static String DB_PATH = "db/database.db";private static String sqliteURL="jdbc:sqlite:" + DB_PATH;//驱动名称private  static  String jdbcNameSqlite = "org.sqlite.JDBC";public static  Connection getSqliteCon() throws SQLException {try {Class.forName(jdbcNameSqlite);Connection conn = null;conn = DriverManager.getConnection(sqliteURL);return conn;} catch (Exception e){Alert alert = new Alert(Alert.AlertType.INFORMATION);alert.setTitle("提示");alert.setHeaderText(null);
//        alert.setContentText(ResultMsg.DB_SQLITE_ERROR.getMsg());alert.setContentText(String.valueOf(e));alert.showAndWait();e.printStackTrace();}return null;}/*** 关闭连接** @throws Exception*/public static void close(ResultSet rs, PreparedStatement st, Connection con) throws SQLException {if (rs != null) {rs.close();if (st != null) {st.close();if (con != null) {con.close();}}}}//关闭连接和 执行 的打开资源public static void close(PreparedStatement st, Connection con) throws SQLException {if (st != null) {try {st.close();} catch (SQLException e) {e.printStackTrace();}}if (con != null) {try {con.close();} catch (SQLException e) {e.printStackTrace();}}}
}
http://www.lryc.cn/news/280822.html

相关文章:

  • 我为什么要写RocketMQ消息中间件实战派上下册这本书?
  • 24校招,Moka测试开发工程师一面
  • Docker(网络,网络通信,资源控制,数据管理,CPU优化,端口映射,容器互联)
  • 开发实践5_project
  • 蓝桥杯准备
  • AtCoder Beginner Contest 336 A-E 题解
  • node各个版本的下载地址
  • JVM实战(17)——模拟对象晋升
  • 帆软笔记-决策表报对象使用(两表格联动)
  • DataGear专业版 1.0.0 发布,数据可视化分析平台
  • AS,android SDK
  • LeetCode第155题 - 最小栈
  • Java微服务系列之 ShardingSphere - ShardingSphere-JDBC
  • Unity中URP下实现能量罩(外发光)
  • Golang 中哪些类型可以作为 map 类型的 key?
  • C# 导出EXCEL 和 导入
  • 学网络必懂的华为CSS堆叠技术
  • SV-7041T 30W网络有源音箱校园教室广播音箱,商场广播音箱,会议广播音箱,酒店广播音箱,工厂办公室广播音箱
  • Could NOT find Threads (missing: Threads_FOUND)
  • 1114: 逆序(数组)
  • uniapp如何调用ANDROID原生函数
  • python 字符串的详细处理方法
  • 蓝桥杯AcWing学习笔记 8-2数论的学习(下)
  • vcs makefile
  • 《Training language models to follow instructions》论文解读--训练语言模型遵循人类反馈的指令
  • Redis的实现二: c、c++的网络通信编程技术,让服务器处理多个client
  • QT上位机开发(动画效果)
  • 手写实现 bind 函数
  • 安卓Android Studio读写MifareOne M1 IC卡源码
  • 一二三应用开发平台文件处理设计与实现系列之5——MinIO技术预研