Results 1 to 2 of 2

Thread: what happens to the db connections after this call?

  1. #1

    Default what happens to the db connections after this call?

    I am passing the dburl value dynamically based on user's selection in my case.

    Code:
    dburl="jdbc:oracle:thin:@${dburl}"
            log.info "$dburl"
            def sql = Sql.newInstance("${dburl}",
                        "test", "test", "oracle.jdbc.OracleDriver")
            def selectEmpStatement="""
             select * from emp
           """
           
            List empListTemp= new ArrayList()
            sql?.eachRow(selectEmpStatement){
                empListTemp.add(it.empno)
            }
    what happens to the connection it created for fetching the data. Will it be taken care by the GORM or I have to close the connection?

    Thanks

  2. #2
    Join Date
    Jun 2010
    Location
    London
    Posts
    304

    Default

    As described here, you will have to manually close the connection via sql.close(). You are basically bypassing GORM.

Posting Permissions

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