Wrong Oracle database and JDBC Driver version printed by Hibernate SettingsFactory

0

Our Java program has been installed on the RHEL 8.5 OS platform. And for database operations in our application, we use hibernate (version hibernate-3.2.7.ga.jar). Additionally, we are utilizing the JDBC driver(version 19.15) and the Oracle 19c(version 19.15) database. But in the log file, we found the below details which were printed from the hibernate.jar file.

15:23:46,949 INFO [SettingsFactory] RDBMS: Oracle, version: Oracle Database 11g Release 11.1.0.0.0 - Production 
15:23:46,949 INFO [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 10.2.0.3.0

The code part in SettingsFactory.class file from hibernate.jar is,


ConnectionProvider connections = createConnectionProvider(props);
  Connection conn = connections.getConnection();
          try {
              DatabaseMetaData meta = conn.getMetaData();
              databaseName = meta.getDatabaseProductName();
              databaseMajorVersion = getDatabaseMajorVersion(meta);
              log.info("RDBMS: " + databaseName + ", version: " + meta.getDatabaseProductVersion() );
              log.info("JDBC driver: " + meta.getDriverName() + ", version: " + meta.getDriverVersion() );
              }

We are confident that nowhere uses 11g, both from the code and the DB side. However, it is yet unclear how Hibernate retrieves this information.

Additionally, I’ve developed a Java class for the application that uses DatabaseMetaData objects to check the database information. Here, I just received the 19c specifics of the projected results.


Product Name - Oracle
Product Version - Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.15.0.0.0
Driver Name - Oracle JDBC driver
Driver Version - 19.15.0.0.0
URL - jdbc:oracle:thin:@XX:XX:XX:XX:1521:XXXX
RDBMS: Oracle, version: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.15.0.0.0
JDBC driver: Oracle JDBC driver, version: 19.15.0.0.0

Please let us know the table from which hibernate retrieves the database details and how to overcome the above issue.

Thanks in advance.

I don’t think anyone still knows how Hibernate 3 works exactly since it’s so old, so you are on your own.

@beikov …Thank you for your reply. And I have 4 ojdbc jars in the library and hibernate uses the oldest jar in that. But in the file, I gave the appropriate ojdbc jar name to use. Why the hibernate connect to old ojdbc jars instead of connecting to the appropriate jar which was specified in the file?

That’s what you get when you put conflicting class files on the class path, seemingly random behavior. Just remove the old JARs.