Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-175

[dbcp] I'd like to run init SQL after JDBC Connection creation in Tomcat DBCP

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2
    • 1.3
    • None
    • Operating System: other
      Platform: Other

    • 37577

    Description

      Hi!

      I'm porting some j2ee web based applications from BEA Web Logic to Tomcat 5.5.
      In BEA Web Lobic connection pool it is possible to specify init SQL qurery
      that server runs after connection is created (before first use). It's very
      good for example of national settings in Oracle. For correct czech sorting i
      have to run "setting query":

      ALTER SESSION SET NLS_SORT = XCZECH

      First time i tryed to write interceptor into my application. This interceptor
      runs ALTER SESSION SET NLS_SORT = XCZECH before evey sorted query (SELECT ...
      ORDER BY...), but i had some performance problems. So i starded to work with
      DBCP. I was very wandered about DBCP packages in Tomcat 5.5 and i did not find
      sources of naming-factory-dbcp.jar. So i refactored, enhanced and compiled
      full DBCP (with pool and collections). Now i'm a little afraid of some library
      conflicts (full DBCP, full Pool and full Collections refactored into tomcat
      packages), but performance is OK and basic tests of my application seems good.

      I added property connectionInitSql for int SQL into BasicDataSource. I had to
      mofify BasicDataSourceFactory for correct setting of this property. Property
      is used in method createConnection() of DriverConnectionFactory to init
      Connection.

      It would be very nice if you will add this init feature into Tomcat DBCP.

      Best regards
      Jiri Melichna

      Attachments

        1. DBCP-175-2.txt
          32 kB
          Jerome Lacoste
        2. DBCP-175-1.txt
          16 kB
          Jerome Lacoste
        3. DBCP-175-2.txt
          19 kB
          Jerome Lacoste
        4. ASF.LICENSE.NOT.GRANTED--dbcp_add_init_sql.zip
          11 kB
          Jiri Melichna

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            psteitz Phil Steitz
            jmelichna@gitus.cz Jiri Melichna
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment