8 Replies Latest reply on Nov 23, 2006 7:04 AM by Vicky Kak

    disable connection pool

    Mike Khlu Newbie

      Hello, Friends

      I'm use microcontainer for tests. Connection pooling is unnecessary and harmful for me. I need to really close JDBC connection when I close WarpedJDBC connection. I use org.jboss.resource.adapter.jdbc.local.LocalTxDataSource.

      Which beans configuration required in my case?

      Thanks.

        • 1. Re: disable connection pool
          Vicky Kak Master

          I am not able to understand what you are asking ?
          And how is this realted tp Microcontainer ?
          Please frame your queries properly so that we can understand what you are asking .

          • 2. Re: disable connection pool
            Mike Khlu Newbie

            Hello vickyk
            thanks for response

            I configure LocalTxDataSource in my jboss-beans.xml


            org.hsqldb.jdbcDriver
            jdbc:hsqldb:file:test-output/staging

            My test accesses to Datatasource through JNDI:
            datasource = (DataSource) new InitialContext().lookup(jdbcUrl);

            and then to connection warper:
            connection = datasource.getConnection();

            connection instanceof WrappedConnection

            and when I close it by
            connection.close()

            WrappedConnection puts real JDBC connection to the connection pool.
            But I need to close JDBC connection!!!

            How i can to do this? or How I can disable the connection pooling in jboss-beans.xml? or In which forum I should post this question?

            thanks again



            connection.close();


            • 3. Re: disable connection pool
              Mike Khlu Newbie

              at previous post

              org.hsqldb.jdbcDriver
              jdbc:hsqldb:file:test-output/staging
              

              means

              <bean name="StagingDSBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
               <property name="driverClass">org.hsqldb.jdbcDriver</property>
               <property name="connectionURL">jdbc:hsqldb:file:test-output/staging</property>
               <property name="userName">sa</property>


              • 4. Re: disable connection pool
                Vicky Kak Master

                >>But I need to close JDBC connection!!!
                I dont understand why do you want to this . If you don't need pooling which is what DS provides you simple get the connection using explicitily through the jdbc api and then close in the application code .
                You can write a POJO which have getConnection()/closeConnection() , configure this in jboss-beans.xml file ....

                • 5. Re: disable connection pool
                  Mike Khlu Newbie

                  >>I dont understand why do you want to this
                  It is for test purposes only. I need to shutdown Embeded HSQLDB to backup dbase.script file after exporting dbase schema (by hibernate), before my tests started. But connection with closed HSQLDB retain in the pool. Then application access to it ... ba-ba-ah!!!. Therefore I need to manually close it.

                  I can'to solve my problem with direct JDBC code, because my application accesses to Datasources and UserTransaction through JNDI. I'm use microcontainer only for this purposes (JNDI & Tx). Certainty I can implement by my hands, but i afraid that it will be painful ...

                  I was expect that "no-pooling" mode is easy configurable on xml.
                  Ok. Which classes I should extends to provide "no-pooling" mode?
                  I think that is WrappedConnection, CachedConnectionManager, LocalTxDataSource

                  • 6. Re: disable connection pool
                    Vicky Kak Master

                    min-pool-size=max-pool-size=0 will give you no-pooling , can you please try this ?

                    • 7. Re: disable connection pool
                      Mike Khlu Newbie

                      It is strange but i've gon exception on this setting yesterday

                      org.jboss.util.NestedSQLException: ... nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 1000 [ms] ))


                      "max-pool-size=0" means "no connection" but not "no pooling"



                      • 8. Re: disable connection pool
                        Vicky Kak Master

                        Yes you are right .... I did not think much here .
                        You will have to write your own POJO . However let me see if we can get the connection handle from the WrapperConnection , but using the DS in this way does not make any sense to me .....
                        Please use this forum
                        http://www.jboss.com/index.html?module=bb&op=viewforum&f=136