[JBoss-user] [Installation & Configuration] - Re: DataSource problem - JBossManagedConnectionPool

2004-05-21 Thread dakota007
Thank you very much to all for the quick responses :-)
Now it works

Frederic

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835810#3835810

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835810


---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Installation & Configuration] - Re: DataSource problem - JBossManagedConnectionPool

2004-05-21 Thread dakota007
This is the code: 

package beans;

import java.sql.*;
import java.util.ArrayList;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;


public class DbBean {

private static DataSource pool;


public static DataSource getPool() {
return pool;
}

public static void makePool() throws Exception{
try{
Context env = (Context) new 
InitialContext().lookup("java:comp/env");

//Look up a DataSource, which represents a connection pool
pool = (DataSource)env.lookup("jdbc/OracleDS");
if (pool == null)
throw new Exception("'OracleDS' is an unknown 
DataSource");

} catch (NamingException ne){
throw new Exception(ne.getMessage());

}
}

//method used for fetching data (only 1 column)
public ArrayList getSelect(String sql){
Statement st = null;
ArrayList arrList = new ArrayList();
Connection connection = null;
try {
connection = pool.getConnection();
st = connection.createStatement();
} catch (SQLException e1) {
e1.printStackTrace();
}

try{   
ResultSet rs = st.executeQuery(sql); 
while(rs.next()){
arrList.add(rs.getObject(1));
}
  rs.close(); 
  st.close(); 
  connection.close(); 
} 
catch (SQLException e) {
e.printStackTrace();
} 
return arrList; 
}

//method used for checking login access
public boolean getLogin(String sql) {
Statement st = null;
ResultSet rs = null;
boolean found = false;

Connection connection = null;
try {
connection = pool.getConnection();
st = connection.createStatement();
rs = st.executeQuery(sql); 
if (rs.next())
found = true;
else
found = false;
rs.close(); 
st.close(); 
connection.close();

} catch (SQLException e1) { 
e1.printStackTrace();
}
return found;
}
}

When I say connection.close() , the connection is given back to the pool. Am I wrong ? 
How is it possible that my pool is running out of connections?

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835801#3835801

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835801


---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Installation & Configuration] - DataSource problem - JBossManagedConnectionPool

2004-05-21 Thread dakota007
I'm using a datasource. The database is Oracle 9i. Everthing works fine, but after a 
certain time I receive these errors:

[STDERR] org.jboss.util.NestedSQLException: No ManagedConnections available within 
configured blocking timeout ( 5000 [ms] ); - nested throwable: 
(javax.resource.ResourceException: No ManagedConnections available within configured 
blocking timeout ( 5000 [ms] ))

WARN  [JBossManagedConnectionPool] Unable to fill the pool due to timeout ( 5000 [ms] )

I don't understand why I'm getting those errors. The only thing I can do is restarting 
JBoss(3.2.3). Please help me.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835799#3835799

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835799


---
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user