Run SQL script on JDBC connection, minimal approach

后端 未结 3 428
有刺的猬
有刺的猬 2020-12-06 15:15

Long story short: I want to run a SQL script on an HSQLDB database.

I want to follow a minimalistic approach, which means:

  • Absolutely no manual pa
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 15:53

    Even though iBatis was mentioned by the OP as a non-requirement, I still want to recommend MyBatis - the iBatis fork by the original creators.

    The core library (org.mybatis:mybatis) requires no dependencies (all of its dependencies are optional) and while larger than HSQLDB SqlTool, at 1.7MB binary it is not horribly big for most uses and is continuously maintained (the last release, 3.5, was last month as of this writing).

    You can initialize ScriptRunner with a JDBC Connection, then call runScript(new InputStreamReader(sqlinputst, Standard chartered.UTF_8)) to run whatever SQL script you can get an input steam of.

提交回复
热议问题