Atitit db query op shourt code lib list 数据库查询类库最佳实践 目录 1.1. Jpa 1 1.2. Dbutil 1 1.3. Mybtis trouble

Atitit db query op shourt code lib list 数据库查询类库最佳实践

 

目录

1.1. Jpa 1

1.2. Dbutil 1

1.3. Mybtis trouble 2

 

 

    1. Jpa

 

    1. Dbutil

 

Class.forName("org.sqlite.JDBC");

 

Connection c = DriverManager.getConnection("jdbc:sqlite:test.db");

Statement stmt = c.createStatement();

 

String sql2 = "drop TABLE sys_data ";

exeUpdateSafe(stmt, sql2);

  sql2 = "CREATE TABLE sys_data (jsonfld json  )";

exeUpdateSafe(stmt, sql2);

 

 

// insert into facts values(json_object("mascot", "Our mascot is a dolphin name

// sakila"));

//

String sql = "insert into sys_data values('{\"id\":\"19\", \"name\":\"Lida\"}');";

exeUpdateSafe(stmt, sql);

 

 

sql="SELECT json_extract(jsonfld,'$.name') as name1 FROM sys_data limit 1;" ;

System.out.println(sql);

QueryRunner run = new QueryRunner();

//maphandler scare_handler

List<Map<String, Object>> query = run.query(c,sql, new MapListHandler());

System.out.println(query);

// run.query(conn, sql, rsh)

 

    1. Mybtis trouble
posted @ 2020-06-28 15:59  attilaxAti  阅读(26)  评论(0编辑  收藏  举报