Results 1 to 7 of 7
  1. #1
    javahelp00 is offline Member
    Join Date
    Feb 2009
    Posts
    4
    Rep Power
    0

    Default Java Database Connections

    How does a class manage the numbers of connections created to a database?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    How does a Class manage anything?

    Why don't you describe what it is that you are actually having a problem with?

  3. #3
    javahelp00 is offline Member
    Join Date
    Feb 2009
    Posts
    4
    Rep Power
    0

    Default

    I was asked to do the following question and im finding it difficult to answer:

    Illustrate with java code how a class can manage the numbers of connections created to a database.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    An int variable that you increase and decrease with every opened/closed connection?

  5. #5
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default to connect or not to connect... that is the question

    What you asked and what the assigment asks for are two differents things...
    I can think of a connection class, that uses an array(s) and threads to manage it. (I'm not an expert ... I know zip about DB connections). This was just the first thing I thought of.
    masijade: what you suggest would just keep track of the currently open connections... it not really would manage anything... probably would part of the conection manager.

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Of course, but then again, he simply said "manage the number of connections", and I never said it was a complete answer.

    It was a back-handed sort of way of saying "I am not going to do this for you."

    Obviously if it is to truely manage connections then it is going to need to create connections, check that the "max" number has not already been opened, and close connections, and be synchronised, etc, etc, etc. But this is his assignment, and until he shows some effort he's not going to get much from me.

  7. #7
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    true... it does say manage the "number" of DB connections. therefore I withdraw me comment, but your answer certainly doesn't help the OP.
    And yes, the OP most certainly has to do his own work.
    It was a back-handed sort of way of saying "I am not going to do this for you."
    yeah... I noticed.
    ..and until he shows some effort he's not going to get much from me.
    OK and I can respect that. Maybe the next you can say that to the OP, in a nice manner.... maybe like "SHow us where your stuck with the code so we can help you"... Just a suggestion...

    So.. back to javahelp00... what have you done? Where are you stuck?

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Similar Threads

  1. Replies: 4
    Last Post: 02-04-2009, 03:19 PM
  2. Replies: 0
    Last Post: 04-01-2008, 10:44 AM
  3. Rejecting connections from a specific IP
    By javaplus in forum Networking
    Replies: 2
    Last Post: 12-21-2007, 02:28 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:15 PM
  5. Connections to data bases
    By Albert in forum JDBC
    Replies: 1
    Last Post: 06-09-2007, 03:50 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
  •