Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Which databases are the most used with Java Date: Mon, 14 Aug 2017 18:14:09 +0200 Lines: 56 Message-ID: References: <87y3qovwjb.fsf@munus.decebal.nl> <87tw1bx2c9.fsf@munus.decebal.nl> <878tins1li.fsf@munus.decebal.nl> <87wp67qhyp.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net YweKw5WmAbQmcrpesEdrKwRr2gpxlGIqR/G/AleGc/qc83VjE= Cancel-Lock: sha1:3r7zJwpBrYCltWV+uogk07B37rE= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: <87wp67qhyp.fsf@munus.decebal.nl> Content-Language: en-GB Xref: csiph.com comp.lang.java.programmer:37220 On 13.08.2017 23:24, Cecil Westerhof wrote: > Cecil Westerhof writes: > >> Robert Klemme writes: >> >>> Another aspect of the original question that puzzled me right from the >>> start: why does it matter at all what JDBC driver is really used. Since >>> all the types are interfaces anyway _any_ JDBC driver should work with >>> the wrapper library (except vendor specific things which require >>> specific types anyway). >> >> The only things that differs (as long as you only use generic >> functionality) is the URLPrefix. That is why I think it is not much >> work to generate the other concrete classes when the abstract and >> first concrete class are finished. > > I think that everything that is needed to generate a new concrete > class is: > package nl.decebal.sql; > > > import java.sql.SQLException; > > > public class SQLFoo extends AbstractSQL { > // ################ main > public static void main(final String[] args) throws SQLException { > AbstractSQL.mainWork(SQLFoo.class.getCanonicalName(), args); > } > > // ################ constructors > public SQLFoo(String database) throws SQLException { > super(database); > } > > // ################ default > @Override > String getURLPrefix() { > return "jdbc:foo:"; > } > } > But why tie your code to concrete JDBC implementations at all, especially since you do not seem to want to create custom code for individual JDBC drivers? Why not just pass in the class name, JDBC URL and other properties which are needed during initialization and free yourself from any dependency? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/