hi all,
I am trying to configure jboss.jcml to create a connection pool and work
with my postgres database..
my question is what will be the context.lookup JNDI Name for the connection?
 ConnectionPoolDataSource cpds =
(ConnectionPoolDataSource)ctx.lookup("??????");
or, If this is not the procedure can someone please post the procedure for
creating a connection pool.
thanks

.
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=PostgresDB">
  <attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImp
l</attribute>
  <attribute name="PoolName">PostgresDS</attribute>             
  <attribute name="URL">jdbc:postgresql://localhost:5432/dev</attribute>
  <attribute name="JDBCUser">post</attribute>
  <attribute name="Password">post123</attribute>
  </mbean>

code to get the connection:

public static Connection getConnection() {

      Connection conn=null;
      try {
// initialize JNDI lookup parameters
            Context ctx = ManualJNDI.getInitialContext();
            System.out.println("got context");
            ConnectionPoolDataSource cpds =
(ConnectionPoolDataSource)ctx.lookup("");
            System.out.println("got datasource");

            PooledConnection pc = cpds.getPooledConnection();
             System.out.println("got pooledconnection");          
              conn = pc.getConnection();
              System.out.println("got connection1");

      }
      catch(Exception exception){
      exception.printStackTrace();
      }
      finally{
      return conn;
      }
  }

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to