Re: loading jdbc Driver in servlet

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: loading jdbc Driver in servlet
Date: 2018-12-16 19:12:23
Message-ID: CADK3HH+q8jTigqzAXaeeXNBmp0wid8iiXKvpB94ZPBvBQVddeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

So you are starting up tomcat yourself ? Perhaps that is the difference ?
I have no idea what the tomcat wrapper does, but I'd be curious if the same
thing happens when stared normally

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On Sun, 16 Dec 2018 at 12:20, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:

> Tomcat version 9. Embedded in my main()
>
> On Dec 16, 2018, at 9:30 AM, Dave Cramer <pg(at)fastcrypt(dot)com> wrote:
>
> My guess is it has something to do with your servlet classpath loader.
> Which servlet engine are you using ?
> Dave Cramer
>
> davec(at)postgresintl(dot)com
> www.postgresintl.com
>
>
> On Fri, 14 Dec 2018 at 16:04, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
>>
>>
>> On Dec 14, 2018, at 2:02 PM, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>>
>>
>>
>> On Dec 14, 2018, at 1:30 PM, Dave Cramer <pg(at)fastcrypt(dot)com> wrote:
>>
>> Strange, I wouldn't think so, but then I haven't used a raw servlet for
>> so long I have no idea.
>>
>>
>> Dave Cramer
>>
>> davec(at)postgresintl(dot)com
>> www.postgresintl.com
>>
>>
>> On Fri, 14 Dec 2018 at 13:29, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>>
>>> Using java 1.8, postgresql-42.1.4.jar, embedded tomcat 9
>>>
>>> It appears to me that I need to make the call
>>> "Class.forName("org.postgresql.Driver)" when the entry is in a servlet. Is
>>> this expected, within a servlet, or is this just *post hoc ergo propter
>>> hoc *at it finest and I changed something else (wittingly or not).
>>> Same code outside of servlet does not need the forced loading of the class
>>> and the manual claims it's not need after java 1.6
>>>
>> I too am suspicious. But the vagaries of javax are daunting.
>> But if I comment it out, as just now, “No suitable driver found...”. I
>> was days playing with configuration and such think that this very specific
>> error message was telling me my CLASSPATH was wrong.
>>
>> I wonder if I have an old javax installation (which I put in place just
>> recently).
>>
>>
>> I’m using javax.servlet-api-3.1.0.jar
>>
>>
>>
>>
>>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anton Shen 2018-12-16 19:33:24 Re: new stored procedure with OUT parameters
Previous Message Rob Sargent 2018-12-16 17:20:35 Re: loading jdbc Driver in servlet