Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2002
    Posts
    7

    Unanswered: Beginner question: What kind of database to use for J2EE?

    Hi,

    What are the deciding factors in choosing a database for J2EE project (creating portal for a community)? From what I understand, certain db such as PostgreSQL has many features such as stored procedure, triggers etc. So I think it is a good database to base the work on (because I came from PHP, so stored proc and triggers are very useful).

    However, with EJB or Hibernate, the need for those features became less. My teammates agree that those features are only for legacy databases, and for creating a new project, a simple data storage such as MySQL would do (even MySQL 3 with no referential integrity, as Hibernate can automatically take care of it). Is this argument valid? I have my doubt though, as I still see people are still keen on using databases with those features.

  2. #2
    Join Date
    Apr 2003
    Posts
    40
    your teammates are dead wrong. Stored procedures and triggers have major advantages when it comes down to raw performance and ensuring database integrity.

    Those of course may not be needed for your project, but that doesn't mean they're useless.

    mySQL isn't a real RDBMS at all, it's not stable enough or performant enough for large scale implementations and traditionally lacks features that enterprise class applications require.

    The deciding factors when choosing a database server are:
    - availabillity. Many customers will have a system in place and require it to be used, so do many hosting providers (especially when you're going to use shared hosting rather than hosting your own servers on their location).
    - price/cost. When you are free, those come into play. A specific system may be much cheaper over the life of the project because of reduced maintenance cost despite higher initial investment.

    My personal favourite is Firebird. Stable, full featured, high performance, low maintenance, low footprint.
    And standards compliant so it's relatively easy to switch to something else if the customer would want to.

  3. #3
    Join Date
    Jan 2005
    Posts
    362
    Quote Originally Posted by jwenting
    your teammates are dead wrong. Stored procedures and triggers have major advantages when it comes down to raw performance and ensuring database integrity.
    Imagine that when you insert values at a table you want to update values of another table- a trigger will do it for you in the database, not a javabean at tomcat for example, is not it?
    dimis

  4. #4
    Join Date
    Apr 2003
    Posts
    40
    a trigger would reliably do it at all times.
    If you don't use a trigger you'd have to be dead sure you can rely on everyone ever inserting into that table to religiously update the other table.

    Takes only a single person who doesn't know that requirement for things to go seriously wrong.

    Triggers can also be used, even more useful, to check whether a record can be deleted.
    While you can put some logic in foreign keys, it's often not enough. A delete trigger can check whether some other table depends on the record you're planning to delete and yield an error if that dependency exist.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by jwenting
    Triggers can also be used, even more useful, to check whether a record can be deleted.
    Yeah right. Just don't be surprised when you try to delete a few hundred records and discover that your statement doesn't complete in 3 days.

  6. #6
    Join Date
    Apr 2003
    Posts
    40
    No such problems here... As always everything depends on your code.
    Write crappy code and you get crappy results, doesn't matter whether it's a database trigger or an external program checking the database.

    In fact a trigger should be more efficient to determine whether there are relations blocking a deletion than a program calling the database to try and retrieve a record that would block that deletion can ever be.

  7. #7
    Join Date
    May 2006
    Posts
    6

    Where's the beef?

    I'm partly surprised, partly shocked by the lack of consideration in your posts. I would think you would have discussed the type and level of database connection, i.e. the level of JDBC connector. The MySQL connector/j is at version 3.1.12 is a level 4 driver!
    But more practically the amount and level of documentation which supports what you are learning surely is a plus. Right now things are advancing at a record pace. Sun Java System Application Server Platform Edition 9 is out. Also check out "Java Feature Bringing Together Eclipse, WTP, Struts, and Hibernate" in JDJ. They mention MySQL not Postgre. btw, MySQL is at 5.0, soon to go to 5.1. Referential integrity and stored procedures has been a big objective for v5!

  8. #8
    Join Date
    Apr 2003
    Posts
    40
    and your point? Is mySQL a real RDBMS just because it now has a class 4 driver?
    It isn't.
    And just because a magazine article uses it in an example instead of something else doesn't make it superior to that something else.

  9. #9
    Join Date
    Jan 2005
    Posts
    362

    Theory

    I thing it is better for us to have some good guidelines for coding and using databases and to use them to collect the database we need and to work with the one we have.

  10. #10
    Join Date
    Apr 2003
    Posts
    40
    Correct. That's why coding in a way that's database independent is so important.
    You often won't know in advance what database you're going to be using in the end (or you think you know and someone changes things on you halfway down the project).
    Same with appservers, even hardware platforms and operating systems.

    Ever created something that was supposed to be deployed on Websphere with a DB/2 backend on AIX only to end up deploying it on Silverstream with an Oracle backend running on HP-Ux, all the while doing development and testing on iPlanet running on AS-400 with an Oracle database?

    I have, it was fun

Posting Permissions

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