Chidambara, Vinoth (CTS) wrote:
> Hai,
>
> I am using JBoss 2.1,winodows NT Server,Sybase Sql Server.
> I have deployed a bean which connects to the database.Actually
> am getting connection like this
>
> Context ctx = new InitialContext();
> DataSource ds = (DataSource)ctx.lookup("java:/TryDB");
> con = ds.getConnection();
As others have pointed out, this will be a pooled connection. You should
map the connection (using a resource-ref in your ejb-jar.xml) to
'jdbc/TryDB' and look it up under the name 'java:comp/env/jdbc/TryDB'.
This will be more portable.
>
> Instead of getting connection like this I need to get a connection
> from connection pool.Since we have a situation like this, we need
> to deploy a bean in JBoss for development purpose and atlast
> we have to deploy that bean to weblogic..
>
> In weblogic we use to get connection like this,
>
> String driver="weblogic.jdbc.pool.Driver";
> String url="jdbc:weblogic:pool:TryDB";
>
> Class.forName(driver).newInstance();
> Connection con=DriverManager.getConnection(url);
Don't do this in EJBs. Use the above method in all cases where you need
a database connection from an EJB.
>
> Same way shall I get the connection pool from JBoss Connection pool.What
> type of driver
> do I need to use .What type of url i have to use.
> Anyone give me hand in this regard.
>
> Thanks in advance,
> With Regards,
> Vinoth.C
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]