Hi there,

given that particular configuration using:

   ConnectionPoolDataSource cpds =
     (ConnectionPoolDataSource)ctx.lookup("java:/PostgresDS");

should obtaining a connection to your database.

To find out what is bound where, you can connect to port 8082 on the 
host running JBoss to access the JMX based html interface to JBoss 
configuration. In particular, have a look for 'service=JNDIView' under 
'DefaultDomain'. From there you can 'list' all bound resources to see 
what is where.

Hope this helps.

Geoff

Kotamraju, Srinivas, BmS- NY1540 wrote:

> 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