Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: Which databases are the most used with Java Date: Thu, 17 Aug 2017 09:04:30 +0200 Organization: Decebal Computing Lines: 78 Message-ID: <87k222lloh.fsf@munus.decebal.nl> References: <87y3qovwjb.fsf@munus.decebal.nl> <87tw1bx2c9.fsf@munus.decebal.nl> <87a833wzcx.fsf@munus.decebal.nl> <87pobz9yv5.fsf@munus.decebal.nl> <87h8x9pfi8.fsf@munus.decebal.nl> <87mv70n5pd.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="e6024f4531edaad88c0dfbce1f5eb8d5"; logging-data="4695"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jhZagGOUbgIyzmrp6MULU4DH9GpNhQ/g=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:4D4cW8Z4iuj7q16CT3hpql3IUnM= sha1:1+k391YW1qklhPEowD5B0DlExt4= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.java.programmer:37258 Arne Vajhøj writes: > On 8/15/2017 12:42 PM, Cecil Westerhof wrote: >> Arne Vajhøj writes: >>> As long as you complete using a ResultSet before opening the next then >>> you can reuse the same Statement. >>> >>> But if yo do not do that then using same Statement (and same Connection >>> - unlike >>> it supports something like MARS) will get you in problems. >> >> And that was my use-case: one try with resources with multiple >> ResultSets. ;-) > > Yes. > > But multiple result sets in the same try (on same statement/connection) > is enough to get you in problems. That is why I started with the wrapper: to make sure that a Statement is implicit generated. There are some extra things added: - displayMetaData - getCount - getDBName - getDBVersion And for SQLite3 I added: - isDBLocked - isDBLockedShowErr I also added a main so that I can use the classes from a script. For example to check about 20 SQLite3 databases about being locked: java -cp ${_classpath} nl.decebal.sql.SQLite3 --areDBsLockedShowErr ${_databases[*]} If I want a message about the databases that are locked. And: java -cp ${_classpath} nl.decebal.sql.SQLite3 --areDBsLocked ${_databases[*]} If I want a message for every database. For every database I have: --displayMetaData With SQLite3 I get: Driver: name = SQLiteJDBC version = native major version = 1 minor version = 1 Database: name = SQLite version = 3.20.0 major version = 3 minor version = 0 user name = null And with H2 I get: Driver: name = H2 JDBC Driver version = 1.3.176 (2014-04-05) major version = 1 minor version = 3 Database: name = H2 version = 1.3.176 (2014-04-05) major version = 1 minor version = 3 user name = SA Is a bit old, but that is the latest stable. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof