EJB Vs JDBC calls

Discussions

EJB design: EJB Vs JDBC calls

  1. EJB Vs JDBC calls (3 messages)

    I am very new to the EJB world and understand the basics. So please pardon me if I am not very clear in explaining my problem.

    I am given an assignment where I need to read data from tables in one database(Informix) and write it to another database(Oracle). The data needs to be transferred once a day and lock contention is not an issue. Maximum data that can be copied is about 1000 rows per table.

    My questions are:
    1. Is there any pattern that addresses my case.
    2. Should I write a Java program that uses direct JDBC calls or should I use EJB's?

    Any thoughts/comments/opinions will be appreciated.
    Jag

    Threaded Messages (3)

  2. EJB Vs JDBC calls[ Go to top ]

    Hi Jag,
    It is my very personal opinion. Having worked on projects involving both JDBC and EJBs I prefer to use JDBC calls to the probelm that you have described. My opinion is based on the following:
    1. It is just a batch process running once a day.
    2. There is little / no transaction isolation involved. I mean, any rollbacks or constraint violation.
    3. The operation is just going to be INSERTS/ UPDATES on the table rather than a distributed transaction.

    I would use EJBs for a transaction that involves a set of inserts/updates/deletes spanning over multiple tables or even multiple databases.

    I would like to use less overhead on demand calls using JDBC for simple inserts/updates/deletes (which I presume is the problem you have described)
    Last but not the least, get some more opinion of experts in this forum before yo jump into a conclusion.
    Good Luck.
    Sekar
  3. EJB Vs JDBC calls[ Go to top ]

    With EJBs though, you get the transactions, and so what it gives you is the ability to do your entire batch process in a transaction, and then at the end, either every row from Informix made it to Oracle, or none did. Depending on your application, it may be a real pain if you get a failure halfway through and can't figure out which rows made it and which didn't. With EJB and transactions, you get all or nothing.

    Dave
  4. EJB Vs JDBC calls[ Go to top ]

    a simple JDBC proggy called once a day are more as enough for your use case.
    tx are also supported by the databases you use even with JDBC. so there is no reason why u should use a fat EJB server with JTA/JTS...

    cy