Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <datasource jndi-name="java:jboss/datasources/PostgreDS" pool-name="PostgreDS" enabled="true" use-java-context="true">
- <connection-url>jdbc:postgresql://192.168.0.112:5432/bdns</connection-url>
- <driver>postgresql</driver>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- <pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>40</max-pool-size>
- <prefill>true</prefill>
- </pool>
- <security>
- <user-name>planosassessoria</user-name>
- <password>060233</password>
- </security>
- <statement>
- <prepared-statement-cache-size>32</prepared-statement-cache-size>
- <share-prepared-statements>true</share-prepared-statements>
- </statement>
- </datasource>
- <drivers>
- <driver name="postgresql" module="org.postgresql">
- <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- package dao;
- import java.sql.Connection;
- import java.sql.SQLException;
- import javax.naming.InitialContext;
- import javax.naming.NamingException;
- import javax.sql.DataSource;
- import org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7;
- import org.postgresql.jdbc.PgConnection;
- public class ConnectionMng {
- private DataSource ds;
- private ConnectionMng() throws NamingException {
- this.ds = (DataSource)new InitialContext().lookup("java:jboss/datasources/PostgreDS");
- }
- public PgConnection getPgConnection() throws SQLException {
- WrappedConnectionJDK7 wrappedConn = (WrappedConnectionJDK7)ds.getConnection();
- Connection underlyingConn = wrappedConn.getUnderlyingConnection();
- return (PgConnection)underlyingConn;
- }
- }
- ClassCastException: org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7 cannot be cast to org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement