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: Sun, 13 Aug 2017 11:07:50 +0200 Organization: Decebal Computing Lines: 89 Message-ID: <87tw1bx2c9.fsf@munus.decebal.nl> References: <87y3qovwjb.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="1615173a1409002a85fbdd25ac4b9ead"; logging-data="17862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JPeloOC34H94fO+mc/AwCG8iuijZdD8g=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:4ssR7WKajVoehcQG0g+6fmSYuak= sha1:SUWe8nF9qrp4gk6MFRWzgBD9XKU= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.java.programmer:37165 Sebastian writes: > Am 13.08.2017 um 07:58 schrieb Cecil Westerhof: >> I am making a wrapper around JDBC. I myself only use SQLite3 (at the >> moment), but I want to share it. Then I should implement (at least) >> the most important databases. I am thinking that the following >> probably are used a lot: >> SQlite >> MySQL >> MariaDB >> PostgreSQL >> Oracle >> SQLServer >> DB2 >> H2 >> Derby >> HyperSQL >> >> I should -I think- at least write an implementation for those. I am >> using Linux, but I understood that nowadays you can run SQLServer on >> Linux. So it should be doable. >> >> Are there any other database that I ‘should’ implement? >> > May I ask, why are you writing that wrapper? For your own convenience, > with a special purpose in mind? Or for pedagogical reasons? Or are you > planning to provide vendor-independent database programming in a new > library, open source or commercial? It started with that I really do not like: try (Statement stmt = conn.createStatement(); ResultSet rsOldest = sqlite3Conn.executeQuery(OLDEST_USED)) { I now can do: try (SQLResultSet rsOldest = sqlite3Conn.executeQuery(OLDEST_USED)) { Because getting count is something I think you do a lot, I also defined (and probably will do others): getCount It does not save a lot, but: many small ones, make a big one. I also created some SQLite3 specific methods: getSQLiteVersion isDBLocked For other databases I can then define other database specific functions. I think that it could be handy to half the resources to declare in your try with resources and have some database specific functions ready. It is also handy not to need to remember the URL prefix. ;-) And the helper functions can be nice. It is mostly for getting my hands dirty, but if it could be useful for others, it would not hurt to make it easy to use it for others. One being that they do not need to implement it for there own database. By the way: one thing that I am going to do is that I implement in SQLResultSet: getXXX(String columnLabel) but not: getXXX(int columnIndex) Because I think you should never use that. > I am asking, because there already are such libraries. To my mind, the > most excellent is the remarkable JOOQ library (https://www.jooq.org/). > The open source part of it is only for open source databases, though. > But I am sure you can learn much from studying it, and reading Lukas > Eder's (the author's) blog posts. That would be certainly interesting to look at. But what I am trying to do does not get even close to that. You could say that what I make is interesting when you only write something simple where jooq would be overkill. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof