• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing Connection pool

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have created a connection pool in Weblogic.I want to access the pool from my client.
There is one remote interface which is defined as follows
ResultSet executeDataBaseQuery(Connection conn,String queryString) throws RemoteException;

My bean implements this interface and sends back the resultset
as follows
public ResultSet executeDataBaseQuery(Connection conn,String queryString)
{
Statement stmt=null;
ResultSet result=null;
try
{
if (conn==null)
{
System.out.println("Connection is null");
}
System.out.println("Inside bean first stmt");
stmt = conn.createStatement();
result=stmt.executeQuery(queryString);
stmt.close();
} catch(SQLException e)
{
System.out.println("Exception inside JDBCConnector.executeDataBaseQuery"+e.getErrorCode());
e.printStackTrace();
return null;
}
return result;

The client code is as follows
public Connection getConn() throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
try
{
Connection conn = null;
Class.forName("weblogic.jdbc.pool.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:weblogic ool raclePool");
System.out.println("Got a connection from JDBC Pool");
if (conn == null)
{
System.out.println("Connection is null in the function getConn()");
}
return conn;
}
catch(Exception e)
{
System.out.println("Could not get free Connection from the pool "+e.getMessage());
e.printStackTrace();
return null;
}
}

When I call the above getconn() from the application it gives error message as
"Pool connect failed"
Could U please tell me where the problem is
Do reply
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you set up the connectionpool,you have to set up the txdatasource in the properties file.then lookup on that datasource name to get the connection.hope this helps.if it is weblogic5.1,look into the properties file you get the info.
 
Joe
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
I changed the txdatasource in the properties file, but still am not able to solve the problem. Am using weblogic 5.1
Can U help me out
 
reply
    Bookmark Topic Watch Topic
  • New Topic