Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37196

Re: Is this a correct implementation of an abstract class and implementation class

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Is this a correct implementation of an abstract class and implementation class
Date 2017-08-13 16:27 -0400
Organization Aioe.org NNTP Server
Message-ID <omqcnu$1j6h$2@gioia.aioe.org> (permalink)
References <87r2wgxz2p.fsf@munus.decebal.nl> <omobrn$mvm$1@gioia.aioe.org> <slrnop07n8.o2q.avl@logic.at> <slrnop09p8.o2q.avl@logic.at>

Show all headers | View raw


On 8/13/2017 6:13 AM, Andreas Leitgeb wrote:
> Andreas Leitgeb <avl@logic.at> wrote:
>> Arne Vajhøj <arne@vajhoej.dk> wrote:
>>> I assume you are aware that with newer Java versions then
>>> Class.forName is not required.
>> I googled for "jdbc" and "forName", hoping that I'd find some with
>> a negative context for "forName", but these still seem to be too
>> well hidden...
>
> Well, found it, afterall, but I'm not overly impressed.
> iiuc, then instead of providing the driver class name and
> the dbURI for an app, I'd instead provide the dbURI to
> the app, and need to provide the used drivername(s) already
> to the JVM.

????

Before:

Class.forName
DriverManager.getConnection

After:

DriverManager.getConnection

 From 2 lines to 1 line.

There are corner cases with drivers not supporting service model,
having two drivers for the same URL etc., but in 99% of cases you
just drop the Class.forName and it works.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-12 23:20 +0200
  Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-12 22:00 -0400
    Re: Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-13 07:14 +0200
    Re: Is this a correct implementation of an abstract class and implementation class Andreas Leitgeb <avl@logic.at> - 2017-08-13 09:37 +0000
      Re: Is this a correct implementation of an abstract class and implementation class Andreas Leitgeb <avl@logic.at> - 2017-08-13 10:13 +0000
        Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-13 16:27 -0400
      Re: Is this a correct implementation of an abstract class and implementation class lewbloch@gmail.com - 2017-08-13 09:49 -0700
      Re: Is this a correct implementation of an abstract class and implementation class Arne Vajhøj <arne@vajhoej.dk> - 2017-08-13 16:25 -0400
  Re: Is this a correct implementation of an abstract class and implementation class Cecil Westerhof <Cecil@decebal.nl> - 2017-08-13 07:33 +0200

csiph-web