Results 1 to 12 of 12
  1. #1
    uthpalaw is offline Member
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Default best way to handle db connection

    Hi, i'm going to create a client app using java, i need to know whether there is a better method (framework) to handle the database.

    i'm using ejb when i'm working with j2ee app, but i don't know if there is a better ( efficient ) method for client applications to work with db. Please advice.

    Thanks

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    What do you mean by a client app?

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    The advantage of creating a 3(+)-tier, EJB based server side application is that the client doesn't need to directly 'work with db'. When that logic is server side, clients don't get crudded up with code that makes it harder to maintain in the long run.

  4. #4
    uthpalaw is offline Member
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Default

    Just a desktop application, not a web application, so i'm not going to run any application servers(tomcat, jboss). Therefore i won't be able to use ejb. I think im correct, am I ?

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    Therefore i won't be able to use ejb. I think im correct, am I ?
    You tell us. You mentioned you use(d) an ejb J2EE application, if this is already developed for the same data source then why re-invent the wheel in the client. But as Tolls alluded to, you haven't provided much information to give specifics.

  6. #6
    uthpalaw is offline Member
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Default

    No, this is a totally different system.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    Design decisions cannot be made based on such a small amount of info.

    Is the database going to be shared between instances of this app?
    If not, then is the database going to be fairly small?
    If it is shared then is it shared with any other apps?

    You have to provide us with informationon which the base our advice.

  8. #8
    uthpalaw is offline Member
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Default

    Yes, database is going to be shared between instances of this app.
    No, it will not be shared with any other applications.

    only this application will communicate with the db.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    So there is already a server involved.
    The one with the db on it.

    I would stick some server code in front of that that handles db interactions personally. Have your app interact with that.

  10. #10
    ora.adf is offline Member
    Join Date
    Feb 2011
    Posts
    5
    Rep Power
    0

    Default

    you must add JDBC driver to your project to connect to db directly without any additional layer .

  11. #11
    uthpalaw is offline Member
    Join Date
    Mar 2010
    Posts
    68
    Rep Power
    0

    Default

    sorry Tolls, i didn't get u.

    What's the server involved with db ?

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    Quote Originally Posted by uthpalaw View Post
    sorry Tolls, i didn't get u.

    What's the server involved with db ?
    You said:

    Quote Originally Posted by uthpalaw View Post
    Yes, database is going to be shared between instances of this app.
    That means multiple instances of your app will be talking to the same db.
    That implies (since you haven't explained anything else about your app) that the db is central and that implies it's on a server.

    You have to realise we do not know your system so are reduced to guesswork when you don't provide us with enough information.

Similar Threads

  1. how to handle data over two distinct socket connection
    By krishforever in forum New To Java
    Replies: 7
    Last Post: 02-03-2011, 10:57 AM
  2. Java.net.socket connection :connection closed
    By veeru541 in forum Advanced Java
    Replies: 2
    Last Post: 06-27-2010, 02:14 AM
  3. How to handle ArrayIndexOutOfBoundsException
    By 3xpr1ment in forum New To Java
    Replies: 6
    Last Post: 03-03-2010, 03:16 PM
  4. Handle sound
    By varsamakos in forum AWT / Swing
    Replies: 4
    Last Post: 12-26-2009, 09:40 PM
  5. how to handle files?
    By sayan751 in forum Advanced Java
    Replies: 5
    Last Post: 06-10-2009, 08:39 PM

Posting Permissions

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