Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

Can't Solve the "Too Many Clients Tasks" Problem

843810Apr 27 2010 — edited Oct 25 2010
Hello All ,

I am creating a java desktop application , and i keep getting this error message:

[Microsoft][ODBC Microsoft Access Driver] Too many client tasks.


Any way ,i googled for this error and i found that because i creates many connections with database "more than 10 i think " , and that why i get this error message ..


The problem is that i do not know how to solve it , i tried to close the connections and i still getting the same error

I searched this forum , and someone suggest to close the connections and the statements and the resultset , but still not working

this is the code
public class Database_Mangement {

    private String User_ID;
    private String  user_name;
    private String password;
    private Admin_Connection c;
    private Connection conn;
    private Connection uni_conn;
    private ArrayList<Admin_TableEntry> data;
    

    public Database_Mangement() throws SQLException
    {
      conn = null;
      uni_conn = null;
      conn = DriverManager.getConnection("jdbc:odbc:smart_database");// Connect with database no 1 through ODBC
      uni_conn = DriverManager.getConnection("jdbc:odbc:uni_database");//Connect with database no 2 through ODBC
      data = new ArrayList<Admin_TableEntry>();
    }
 
     ArrayList<Admin_TableEntry> getInformation(int type)throws SQLException
     {
         Statement stm = null;
         ResultSet getInfo = null;
       try{
         //get User Information
            
            if(type==1)
            {
                 stm = conn.createStatement();
                String temp;
                temp = "select * from Students";
                getInfo = stm.executeQuery(temp);
            }
            else if(type==2)
            {
                 stm = uni_conn.createStatement();
                String temp;
                temp = "select * from Students";
                getInfo = stm.executeQuery(temp);
            }
             
            
           
             while(getInfo.next())
             {
                  Admin_TableEntry tempclass = new Admin_TableEntry();
                  if(type==1)
                  {tempclass.ID = getInfo.getString("Student_ID");
                   tempclass.Name =getInfo.getString("Student_Name");
                   tempclass.balance=getInfo.getString("Student_Balance");}
                  else if(type==2)
                  {
                      tempclass.ID =getInfo.getString("Student_ID");
                      tempclass.Name = getInfo.getString("First_Name");
                      tempclass.Last_Name =getInfo.getString("Last_Name");
                      tempclass.haveaccount=getInfo.getBoolean("Have_SmartCard");
                  }
                   
                   data.add(tempclass);
           }
      }
catch(Exception e)
{System.out.println(e.getMessage();}
 finally
 {
     conn.close();
     uni_conn.close();
    stm.close();
//    getInfo.close();  Please note that i get an error message when i try to close the ResultSet
//and this is the error message
// Exception in thread "main" java.sql.SQLException: ResultSet is closed


 }
 


               return data;

     }

}
and thank you for your time..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2010
Added on Apr 27 2010
3 comments
1,197 views