Start a new topic

create or replace and compile java source .... failing

[This topic is migrated from our old forums. The original author name has been removed]

I am trying to create new java source/class in DbVisualizer window by running following: 1 create or replace and compile java source named example as 2 static class example 3 { public static String returnTrue() { return "TRUE"; } }; 4 / In the log window below i am seeing "... 0 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 0 errors]" no java source created in debug window getting following errors/messages: 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 AbstractFacade.getColumn] executing "select sys_context( 'userenv', 'current_schema' ) from dual" 11:52:02 [DEBUG pool-4-thread-6 C.?] DefaultEditor30: T4CConnection.createStatement() 11:52:02 [DEBUG pool-4-thread-6 B.?] DefaultEditor30: OracleStatementWrapper.executeQuery("select sys_context( 'userenv', 'current_schema' ) from dual") 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 J.execute] Executing... 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 J.setCurrentCatalog] DbConnection='Oracle-DEV' Catalog='null' Schema='null' NewCatalog='null' 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 AbstractFacade.getColumn] executing "select sys_context( 'userenv', 'current_schema' ) from dual" 11:52:02 [DEBUG pool-4-thread-6 C.?] DefaultEditor30: T4CConnection.createStatement() 11:52:02 [DEBUG pool-4-thread-6 B.?] DefaultEditor30: OracleStatementWrapper.executeQuery("select sys_context( 'userenv', 'current_schema' ) from dual") 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 J.setCurrentSchema] DbConnection='Oracle-DEV' Catalog='null' Schema='INC' NewSchema='INC' 11:52:02 [DEBUG ExecutorRunner-pool-3-thread-3 AbstractFacade.getColumn] executing "select sys_context( 'userenv', 'current_schema' ) from dual" 11:52:02 [DEBUG pool-4-thread-6 C.?] DefaultEditor30: T4CConnection.createStatement() 11:52:02 [DEBUG pool-4-thread-6 B.?] DefaultEditor30: OracleStatementWrapper.executeQuery("select sys_context( 'userenv', 'current_schema' ) from dual") 11:52:02 [DEBUG pool-4-thread-6 C.?] DefaultEditor30: T4CConnection.createStatement() 11:52:02 [DEBUG pool-4-thread-6 B.?] DefaultEditor30: OracleStatementWrapper.execute("create or replace and compile java source named example as static class example { public static String returnTrue() { return "TRUE"; } }; /") java.sql.SQLException: Non supported SQL92 token at position: 88: public at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271) at oracle.jdbc.driver.OracleSql.handleToken(OracleSql.java:1245) at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:1136) at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:1053) at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:310) at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:604) at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:169) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:942) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222) at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1770) at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1739) at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:299) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.onseven.dbvis.g.B.B.?(Z:1910) at com.onseven.dbvis.g.B.F$A.call(Z:1474) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) SQLState(99999) vendor code(17034) 11:52:02 [DEBUG pool-4-thread-6 B.?] DefaultEditor30: EXCEPTION -> java.lang.NullPointerException: null java.lang.NullPointerException at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:1153) at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:948) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222) at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1770) Any idea what i am doing wrong ?

[This reply is migrated from our old forums.]

Re: create or replace and compile java source .... failing
Hi, A couple of things. Since the statement contains semi colons, you must handle it as a complex statement as described here: http://confluence.dbvis.com/display/UG92/Executing+Complex+Statements In addition, the curly braces are interpreted by the JDBC driver as JDBC escapes. You therefore need to disable JDBC escape processing by adding this Driver property in the Properties tab for the connection and reconnect: java.sql.statement.setEscapeProcessing: false I hope that helps. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: create or replace and compile java source .... failing
Thank you a lot, java.sql.statement.setEscapeProcessing: false did the trick, now i see valid java source in my DB. Best Regards Leszek P.S. By the way, do you know how to include external libraries as well? In my project i need 2 external libraries to be included db2jcc_license_cisuz.jar and db2jcc_license_cu.jar . I have jars, do not know , how to inform Oracle DB about them. Thanks again Leszek Edited by: leszek on Jun 15, 2015 1:27 PM
[This reply is migrated from our old forums.]

Re: create or replace and compile java source .... failing
Hi Leszek, Great to hear it solved the problem. The db2jcc_license_cisuz.jar and db2jcc_license_cu.jar are, as far as I recall, license files for DB2 (not Oracle). You can open Tools->Driver Manager and then load them for the driver: http://confluence.dbvis.com/display/UG92/Installing+a+JDBC+Driver#InstallingaJDBCDriver-LoadingandConfiguringDriversManually Best Regards, Hans