Menu

Batch SQL and Oracle Temp tables ?

SRC FRG
2003-09-15
2003-09-16
  • SRC FRG

    SRC FRG - 2003-09-15

    Hi All

    I am a new to this, So please bear with me.

    I have SQLJ program and we use lot of Oracle Global Temp tables as intermediate steps rather than dealing with java objects. Hope you guys know how they work!
    In our program we start the DB connection at start of the program and use the same through-out because we are dealing with temp tables. sort of batch sql but not exactly.

    The whole program is cluttered with result set and exception handleing is not so elagent Hence I am thinking of using this great JDBC framework.

    How do I use spring in these kind of situation.? I need to start connection at the start and after that all I have to deal with is just sql statements and its result set once all the sql's execution is completed the connection should not close untill I ask framework to close!!

    Is there any way to handle this with spring framework??

    Please help and let me know.
    Thanks and Regards
    Joan H.

     
    • Rod Johnson

      Rod Johnson - 2003-09-16

      Spring can use a SmartDataSource (subinterface of J2EE DataSource, in Spring core JDBC package). This can tell Spring JDBC whether to close a connection from a DataSource.

      I think your options are to implement a SmartDataSource wrapper for your underlying datasource, or to use a proxy (such as an AOP proxy) that intercepts close calls on the actual datasource. Our AOP makes this second option fairly straightforward, and I can provide further advice on it if you need.

      Regards,
      Rod

       
      • Thomas Risberg

        Thomas Risberg - 2003-09-16

        One SmartDataSource wrapper that I have used for batch type processing is SingleConnectionDataSource.
         
        You should also be able to share the same connection between SQLJ and Spring's JDBC framework.  You could use getConnection() on SQLJ's connection context and pass that into the constructor for the SingleConnectionDataSource.  I guess you could go the other way too, passing in a connection created by Spring by passing it in when you create the DefaultContext for SQLJ.  All this assuming that you are keeping some of your SQLJ code.

        Thomas

         

Log in to post a comment.

MongoDB Logo MongoDB