Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle compatibility #2777

Merged
merged 3 commits into from
May 29, 2018
Merged

Oracle compatibility #2777

merged 3 commits into from
May 29, 2018

Conversation

PascalLike
Copy link
Contributor

This PR fix the Oracle DB compatibility and fix some code style issues on some entities (commit bd97bc6)

There are also some code style fixes on some entities (commit 1d40cf0)

@PascalLike
Copy link
Contributor Author

Please @Delawen, can you give a look?

@josegar74 josegar74 requested a review from Delawen May 17, 2018 12:16
@josegar74
Copy link
Member

@PascalLike I see for example in https://github.com/geonetwork/core-geonetwork/blob/3.4.x/domain/src/main/java/org/fao/geonet/domain/MetadataValidation.java#L141-L145 that is not using the BooleanToYNConverter.

I have done a quick check and other cases in the domain package have isTransient annotation so looks fine not to use the BooleanToYNConverter.

But in any case if you can verify no more cases also would be great, thanks.

@PascalLike
Copy link
Contributor Author

@josegar74 this should not be an issue... I checked and it seems that hibernate manage the conversion from boolean to NUMBER in this cases. I'm not sure why sometimes the BooleanToYNConverter is necessary, maybe another DBMS? Or it was necessary before with some older library?

database

@josegar74
Copy link
Member

@PascalLike afaik BooleanToYNConverter is used for Oracle compatibility and was introduced by @etj as seem Boolean fields cause issues in Oracle, see #1968

@josegar74 josegar74 added this to the 3.4.3 milestone May 22, 2018
@PascalLike
Copy link
Contributor Author

Please @etj , if you have time to add some extra info it would be really useful. I did my tests on Oracle 12c and I found that it works without issues (just a conversion from boolean to NUMBER). I will do some extra tests on Oracle 11, probably the issues are on older versions.

@Delawen
Copy link
Contributor

Delawen commented May 24, 2018

I still get this error:
Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded

When starting GeoNetwork over an empty database. Maybe I didn't configure it right?

Copy link
Contributor

@Delawen Delawen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there is a mistake on the oracle.xml file, as the port is fixed:

$ git diff web/src/main/webResources/WEB-INF/config-db/oracle.xml
diff --git a/web/src/main/webResources/WEB-INF/config-db/oracle.xml b/web/src/main/webResources/WEB-INF/config-db/oracle.xml
index 1fe61bf71a..1d7f50bfcb 100644
--- a/web/src/main/webResources/WEB-INF/config-db/oracle.xml
+++ b/web/src/main/webResources/WEB-INF/config-db/oracle.xml
@@ -51,7 +51,7 @@
   </bean>
 
   <bean id="jdbcURL" class="java.lang.String">
-    <constructor-arg value="jdbc:oracle:thin:@${jdbc.host}:1521:${jdbc.database}"/>
+         <constructor-arg value="jdbc:oracle:thin:@${jdbc.host}:${jdbc.port}:${jdbc.database}"/>
   </bean>
 
 </beans>

@@ -1,119 +0,0 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing a whole file for Oracle compatiblity? This is weird... Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table's not needed anymore, not really related to Oracle compatibility, but it created issues, so I decided to remove it directly here

@Delawen
Copy link
Contributor

Delawen commented May 24, 2018

Probably the cursos error comes from this previous error (that leaves the connection on a weird state?):

2018-05-24 13:01:12,517 WARN  [geonetwork.databasemigration] -       Database does not contain any version information. Check that the database is a GeoNetwork database with data. The database is probably empty, no migration required.
2018-05-24 13:01:21,141 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - HHH000388: Unsuccessful: alter table GUF_UserFeedbacks add constraint FK_fdrac6cxjiirwxm814musflwy foreign key (metadata_uuid) references Metadata (uuid)
2018-05-24 13:01:21,141 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - ORA-02275: such a referential constraint already exists in the table

2018-05-24 13:01:22,732 WARN  [geonetwork.databasemigration] -       Database does not contain any version information. Check that the database is a GeoNetwork database with data. The database is probably empty, no migration required.
2018-05-24 13:01:28,958 WARN  [geonetwork.data.directory] -     - Data directory properties is not set. Use geonetwork.dir or geonetwork.dir properties.
2018-05-24 13:01:28,958 WARN  [geonetwork.data.directory] -     - Data directory provided could not be used. Using default location: /var/git/core-geonetwork/web/src/main/webapp/WEB-INF/data
2018-05-24 13:01:28,978 WARN  [geonetwork.database] - Executing SQL from: WEB-INF/classes/setup/sql/data data-db-
2018-05-24 13:01:29,330 WARN  [geonetwork.database] - SQL failure for:  INSERT INTO IsoLanguages (id, code, shortcode) VALUES  (281,'mkh', NULL), error is:org.hibernate.exception.GenericJDBCException: could not execute statement
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
        at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)
        at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
        at org.hibernate.jpa.spi.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1771)
        at org.hibernate.jpa.spi.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:87)
        at org.fao.geonet.lib.DbLib.runSQL(DbLib.java:122)
        at org.fao.geonet.lib.DbLib.access$000(DbLib.java:52)
        at org.fao.geonet.lib.DbLib$1.doInTransaction(DbLib.java:76)

And at the end of a long trace, it says:

Caused by: Error : 1000, Position : 0, Sql = INSERT INTO IsoLanguages (id, code, shortcode) VALUES  (281,'mkh', NULL), OriginalSql = INSERT INTO IsoLanguages (id, code, shortcode) VALUES  (281,'mkh', NULL), Error Msg = ORA-01000: maximum open cursors exceeded

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
        ... 87 more
2018-05-24 13:01:29,334 ERROR [jeeves] - Error occurred within a transaction

I am testing with this Oracle: https://hub.docker.com/r/wnameless/oracle-xe-11g/

@PascalLike
Copy link
Contributor Author

@Delawen, all the errors are related to the maximum number of cursors open... I had the same problem, to solve it by giving to my Oracle user more advanced dba permissions, with an unlimited number of cursors. After the first startup, you can switch back to the normal permissions.

@juanluisrp
Copy link
Contributor

It would be good to merge GN 3.4.x in your branch to fix the broken Travis tests and check if your PR causes any new issue, @PascalLike.

@pvgenuchten pvgenuchten merged commit 4a7f9b6 into geonetwork:3.4.x May 29, 2018
@juanluisrp
Copy link
Contributor

Tested in an Oracle 11g XE without problems.

To avoid the ORA-01000: maximum open cursors exceeded error I changed these two properties in jdbc.properties:

jdbc.basic.poolPreparedStatements=false
jdbc.basic.maxOpenPreparedStatements=-1

After the initial database creation it can be set to normal:

jdbc.basic.poolPreparedStatements=true
jdbc.basic.maxOpenPreparedStatements=1200

@christian772-84
Copy link

I am new to this, I am connecting geonetwork 3.6 to an Oracle 12c database and I get the following error:

ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - HHH000388: Unsuccessful: alter table GUF_UserFeedbacks add constraint FK_fdrac6cxjiirwxm814musflwy foreign key (metadata_uuid) references Metadata (uuid)
ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - ORA-02275: ya existe una restricci¾n referencial de este tipo en la tabla

ADVERTENCIA [main] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Fallo al escanear [file:/C:/apache-tomcat-9.0.21/lib/orai18n-mapping.jar] desde la herarquia classloader hierarchy
java.io.FileNotFoundException: C:\apache-tomcat-9.0.21\lib\orai18n-mapping.jar (El sistema no puede encontrar el archivo especificado)

ADVERTENCIA [main] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Fallo al escanear [file:/C:/apache-tomcat-9.0.21/lib/orai18n-utility.jar] desde la herarquia classloader hierarchy
java.io.FileNotFoundException: C:\apache-tomcat-9.0.21\lib\orai18n-utility.jar (El sistema no puede encontrar el archivo especificado)

ADVERTENCIA [main] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Fallo al escanear [file:/C:/apache-tomcat-9.0.21/lib/orai18n-collation.jar] desde la herarquia classloader hierarchy
java.io.FileNotFoundException: C:\apache-tomcat-9.0.21\lib\orai18n-collation.jar (El sistema no puede encontrar el archivo especificado)

ADVERTENCIA [main] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Fallo al escanear [file:/C:/apache-tomcat-9.0.21/lib/orai18n-translation.jar] desde la herarquia classloader hierarchy
java.io.FileNotFoundException: C:\apache-tomcat-9.0.21\lib\orai18n-translation.jar (El sistema no puede encontrar el archivo especificado)

deploys the geonetwork application, but at the time of loading the standard generates new errors, I don't know what the problem is, they could help me with a geonetwork to oracle connection manual maybe I forget something.

install the .jre, the jdbc, modify the file jdbc.properties and the srv tables METADATA and SPATIAL_REF_SYS I have to create it directly in oracle since I do not create them automatically.

I appreciate your help and collaboration

@christian772-84
Copy link

the errors that it presents to me when I charge a new norm is the following:

WARN [geonetwork.settings] - Requested setting with name: metadata/import/restrict but null value found. Check the settings table.
ERROR [geonetwork.datamanager] - Error loading iso19115-3 template file C:\apache-tomcat-9.0.21\webapps\geonetwork\WEB-INF\data\config\schema_plugins\iso19115-3\templates\sub-dq-measure-5.xml. Error is could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch.

Caused by: java.sql.BatchUpdateException: ORA-01465: n·mero hexadecimal no vßlido

Caused by: org.hibernate.exception.GenericJDBCException: could not execute batch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants