>>>>> "iap" == i am philips <[EMAIL PROTECTED]> writes:
iap> Hi, I'm new to JBOSS. I tried to access the default connection
iap> pool. but i'm getting errror am i doing it correctly??
iap> i used like this InitialContext ic = new InitialContext(p);
iap> ds = (DataSource) ic.lookup("java:/DefaultDS");
iap> cn = ds.getConnection();
This is how I do this:
===============================================================================
/**
* Describe <code>getConnection</code> method here.
*
* @param context an <code>InitialContext</code> from the calling bean
* @param jndiName a <code>String</code> containing the JNDI
* namespace to connect to
* @return a <code>Connection</code> value
*/
public static Connection getConnection( String jndiName )
{
// request a connection from a datasource which we obtain from
// the JNDI environment
try {
InitialContext context = new InitialContext();
DataSource ds =
(DataSource)context.lookup( jndiName );
return ds.getConnection();
}
catch( NamingException e ){
throw new EJBException( "ExtendedJDBC: NamingException: " + e.getMessage()
);
}
catch( SQLException e ){
throw new EJBException( "ExtendedJDBC: SQLException: " + e.getMessage());
}
}
===============================================================================
Also, worth checking whether the startup log tells you that this db is
actually bound to (java:/DefaultDS)
iap> Please help me to resolve this problem
Hope this helps
--
Nicolai P Guba http://www.gnu.org http://www.frontwire.com
mailgo:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
GSM: +44 (0)7909 960 751 DDI: +44 (0)20 7368 9708
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user