Results 1 to 6 of 6
  1. #1
    radz is offline Member
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    Default Error When Executing Query

    How to solve this problem?...

    Error When Executing Query
    java.sql.SQLException:Data source rejected establishment of connection, messge from server:"Too many connection"

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    May be somewhere in your code same connections are open, but not close them properly. Check that how many connections you have when you execute the query.

  3. #3
    daGame is offline Member
    Join Date
    May 2008
    Posts
    24
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    May be somewhere in your code same connections are open, but not close them properly. Check that how many connections you have when you execute the query.
    Indeed. The error states that You are not closing the connection after

    finishing your task. Are you using a try{} catch() {} and finally{} block?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Yes, use try-catch-finally blocks and in the finally block close all open connections on your application.

  5. #5
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    6

    Default

    I have encountered that same problem before. I have around 3000 connections at a time. The solution i did is i used a batch processing.
    My program connects to the database every 300 entries and uses only 1 connection at a time. Try searching about batch processing in java. And make sure you close your connections after you used them ^_^
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Whatever the theory you follows, major thing you have to keep in mind is clear anything have to at the end of the application. But not all, some of them have to clear up on the way to end. That is the major issue you comes up with your application. I'm directing this to our thread starter. :)

Similar Threads

  1. Executing a jar file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 02-14-2014, 09:02 AM
  2. [SOLVED] executing java over network
    By jmHoekst in forum New To Java
    Replies: 6
    Last Post: 06-30-2008, 05:58 PM
  3. Problem with executing
    By mcal in forum New To Java
    Replies: 2
    Last Post: 02-09-2008, 01:51 PM
  4. Executing Batch
    By zcoarens in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 09:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •