Results 1 to 5 of 5

Thread: what does jdbcTemplate do for us?

  1. #1
    Join Date
    Nov 2005
    Posts
    8

    Default what does jdbcTemplate do for us?


    when I use JdbcDaoSupport, need I close the resultset,close
    the datasource connection everytime I execute some sql?
    need I add a transaction to every method in the class?

    what does jdbcTemplate do for us and what should we do when using it?

  2. #2
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    Did you read the documentation?
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  3. #3
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    No, you don't need to close the resultset, connection, etc. What JdbcTemplate does for you is provide various methods for accessing your database without having to worry about catching exceptions or closing your resources.

    Basically JdbcTemplate is the basis of straight JDBC in Spring.
    Bill

  4. #4
    Join Date
    Nov 2005
    Posts
    8

    Default

    Quote Originally Posted by trisberg
    Did you read the documentation?
    thank you.

    well,I now have read that.there is no need to close the resultset or the connection,but a kind of situation confused me.
    I am using JdbcDaoSupport to access my db,which is wrapped with c3p0 datasource;I was trying to invoke a method in my DAO(include result operations) while iterating a resultset in another method.then c3p0 indicated that there's a deadlock! after I added xml-define transaction to these methods,the deadlock disappeared.how to explain this?

    also deadlock hints appear while I am using hibernate in an other program.
    I cannot find why this keeps happening(I add transaction per request in
    the filter in this program using hibernate).

  5. #5
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    Could you post the method which invokes the JdbcTemplate, including any classes used to read the resultset?
    Bill

Posting Permissions

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