log4jdbc icon indicating copy to clipboard operation
log4jdbc copied to clipboard

OracleRdmsSpecifics needs to be public for connection wrapping within code

Open GoogleCodeExporter opened this issue 9 years ago • 7 comments

What steps will reproduce the problem?
Directly wrapping connection using ConnectionSpy(Connection conn, RdmsSpecifics 
specifics) is not possible because OracleRdmsSpecifics is package scoped. 

What is the expected output? What do you see instead?
proper logging of time and dates for Oracle utilizing to_date/timestamp.

What version of the product are you using? On what operating system?
log4jdbc4-1.2



Original issue reported on code.google.com by [email protected] on 14 Dec 2012 at 6:29

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Good find. RdbmsSpecifics and all it's subclasses should probably be public, 
huh?

Original comment by [email protected] on 14 Dec 2012 at 7:56

  • Changed state: Accepted
  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Or... possibly have the appropriate RdbmsSpecifics configured based on the 
driver within the Connection instance passed into the one arg constructor. 

// Something like this... not tested ;)

  public ConnectionSpy(Connection realConnection)
  {
    this(realConnection, findRdmsSpecifics(realConnection));
  }

   ... 

  private static RdbmsSpecifics findRdmsSpecifics(Connection realConnection){
        RdbmsSpecifics rdbmsSpecifics = DriverSpy.defaultRdbmsSpecifics;
        try {
            String driver = realConnection.getMetaData().getDriverName();
            if(DriverSpy.rdbmsSpecifics.containsKey(driver)){
                rdbmsSpecifics = (RdbmsSpecifics) DriverSpy.rdbmsSpecifics.get(driver);
            }
        } catch (SQLException e) {
            // Log something useful here
        }
        return rdbmsSpecifics;
  }

Original comment by [email protected] on 14 Dec 2012 at 8:25

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

I like that idea.

Original comment by [email protected] on 14 Dec 2012 at 8:33

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Let me know if you are interested in adding any contributors. I'd be more than 
happy to make the change and also work on getting this into maven.

Original comment by [email protected] on 14 Dec 2012 at 8:41

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Why don't you work out a patch for your idea, test it and we'll see?

Original comment by [email protected] on 15 Dec 2012 at 9:48

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

Sure

Original comment by [email protected] on 16 Dec 2012 at 3:51

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter

I worked out the patch and converted the build to maven. Not sure if you
want to switch to maven or not though. Let me know. I'd have to send you
the zip because i would need to be able to commit in order to modify the
directory structure. The maven build is a multimodule build that will build
the jars for both JDBC3 and 4 as well as generate a site, javadoc and
changeset report.

Original comment by [email protected] on 27 Dec 2012 at 3:40

  • Added labels: ****
  • Removed labels: ****

GoogleCodeExporter avatar Mar 30 '15 12:03 GoogleCodeExporter