Обсуждение: [Postgis][javax.sql.DataSource] Failed

Поиск
Список
Период
Сортировка

[Postgis][javax.sql.DataSource] Failed

От
Micka
Дата:
Hi,

I'm developping an application on Tomcat7.

I'm using the DataSource for pooling my connection :

<Context reloadable="false">
  <Resource name="jdbc/TestPool"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="20000"
    logAbandoned="true"
    removeAbandoned="true"
    removeAbandonedTimeout="10"
    testOnBorrow="true"
    validationQuery="SELECT 1"
    validationInterval="30000"
    username="Test"
    password="**********"
    driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://172.17.100.14/D_TEST?autoReconnect=true"
  />
</Context>


It seems that the connection that I got can't be casted to PGconnection :

java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection
    at Test.DataBaseConnector.connection(DataBaseConnector.java:134)
    at Test.DataBaseConnector.<init>(DataBaseConnector.java:94)
    at Test.Guardian_Process.<init>(Guardian_Process.java:36)
    at Test.ServletListener.contextInitialized(ServletListener.java:36)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4600)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5097)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5092)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


So my question is:

How can I manipulate geometry data In my case ?

Re: [Postgis][javax.sql.DataSource] Failed

От
Dave Cramer
Дата:
Micka,

>
> So my question is:
>
> How can I manipulate geometry data In my case ?
>


AFAIR there is a way to get the underlying connection. You will have
to get that to cast it.

Dave

Re: [Postgis][javax.sql.DataSource] Failed

От
Thomas Kellerer
Дата:
Dave Cramer, 17.03.2011 15:24:
> Micka,
>
>>
>> So my question is:
>>
>> How can I manipulate geometry data In my case ?
>>
>
>
> AFAIR there is a way to get the underlying connection. You will have
> to get that to cast it.
>
> Dave
>

See the description here:

http://commons.apache.org/dbcp/configuration.html
(property: accessToUnderlyingConnectionAllowed)

It also contains an example on how to obtain the physical java.sql.Connection

It should be possible to cast that to the PGConnection then.



Re: [Postgis][javax.sql.DataSource] Failed

От
Micka
Дата:
Thx all !

You helped me a lot !

On Thu, Mar 17, 2011 at 3:52 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:
Dave Cramer, 17.03.2011 15:24:

Micka,


So my question is:

How can I manipulate geometry data In my case ?



AFAIR there is a way to get the underlying connection. You will have
to get that to cast it.

Dave


See the description here:

http://commons.apache.org/dbcp/configuration.html
(property: accessToUnderlyingConnectionAllowed)

It also contains an example on how to obtain the physical java.sql.Connection

It should be possible to cast that to the PGConnection then.




--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc