ORA-01460 with mod_owa and OwaDocTable - oracle

I'm playing with Doug McMahon's Apache PL/SQL Gateway Module (https://oss.oracle.com/projects/mod_owa/dist/documentation/modowa.htm) in a test environment. I'm getting the error below while trying to upload a binary file using the OwaDocTable option. Same code works with mod_plsql.
SQL ERROR
Error 1460 calling procedure:
ORA-01460: unimplemented or unreasonable conversion requested
The last SQL statement executed was:
begin insert into ATEC2_SCHEMA.UPLOADS (NAME, MIME_TYPE, DOC_SIZE, DAD_CHARSET, LAST_UPDATED, CONTENT_TYPE, BLOB_CONTENT) values (:B1, :B2, :B3, :B4, SYSDATE, 'BLOB', empty_blob()) returning BLOB_CONTENT into :B5; end;

I forgot to specify that my test environment was an old 32 bit linux system with Apache 2.0. I try to replicate the problem in a more modern 64 bit linux system with Apache 2.2 and the app works there. So problem solved.

Related

Can't enable JavaScript MLE on APEX

I am running Oracle APEX 21.1 (build 21.1.3.r1531102) on the 21c express database and for some reason I cannot execute server side code with the JavaScript MLE option.
In the develpment environment it does not show the option at all.
In the SQL commands screen I can only execute pure sql or PL/SQL. If I try to execute the following example
SET SERVEROUTPUT ON;
DECLARE
ctx dbms_mle.context_handle_t;
user_code clob := q'~
console.log('Hello World!');
~';
BEGIN
ctx := dbms_mle.create_context();
dbms_mle.eval(ctx, 'JAVASCRIPT', user_code);
dbms_mle.drop_context(ctx);
EXCEPTION
WHEN others THEN
dbms_mle.drop_context(ctx);
RAISE;
END;
I get the following message:
ORA-00922: missing or invalid option
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_210100", line 673
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1703
ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_210100", line 659
ORA-06512: at "APEX_210100.WWV_FLOW_DYNAMIC_EXEC", line 1854
A few weeks ago we solved this and I forgot to update this question.
After some work we found out that user needed to be granted access to MLE. I was not that one who fixed, but I've asked the code to post here, check below:
GRANT MLE JAVA
GRANT EXECUTE DYNAMIC MLE to XYZ;
GRANT EXECUTE ON JAVASCRIPT TO XYZ;
Remove the first line or comment this out, I suppose this is for on premise DB version support but not allowed in ADB.

How to call a procedure in Oracle from clojure

I want to be able to call a procedure in an Oracle database using Clojure.
I have a connection to an Oracle database and I can query the tables of the db using select queries with parameters.
E.g.: If I run "SELECT * FROM user_tables" I get the list of tables as the result. So the connection is working and I do have the correct credentials to make this connection.
I'm using the following dependencies:
[org.clojure/clojure "1.10.1"]
[org.clojure/java.jdbc "0.7.11"]
and as oracle driver I tried these
[oracle.jdbc/oracledriver "11.2.0.2"] (ojdbc6 driver I installed locally under this name)
[oracle.jdbc/ojdbc7 "12.1.0.2"]
[com.oracle/ojdbc8 "19.3.0.0"] or [oracle.jdbc/ojdbc8 "12.2.0.1"]
My java version is:
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
Using the ojdbc6 driver results in:
Execution error (SQLException) at oracle.jdbc.driver.T4CTTIoer/processError (T4CTTIoer.java:440).
ORA-29481: Implicit results cannot be returned to client.
ORA-06512: at "SYS.DBMS_SQL", line 2785
ORA-06512: at "SYS.DBMS_SQL", line 2779
ORA-06512: at "<My procedure name>", line 157
ORA-06512: at line 1
Using the version 7 or 8 result in:
#:next.jdbc{:update-count -1}
Can anyone help me to solve this in such a way that I can see the same result set as in SQL-Developer?
Clojure code used to make the connection:
(defstate ^:dynamic *oracle*
"This variable has the database connection to the Oracle Database"
:start
(if-let [jdbc-url (:oracle (env :database-url))]
(conman/connect! {:jdbc-url jdbc-url})
(do
(log/warn "database connection URL was not found, please set :database-url for oracle in your config, e.g: dev-config.edn")
*oracle*))
:stop
(conman/disconnect! *oracle*))
(conman/bind-connection *oracle* "sql/queries-oracle.sql")
In resources/sql there is the file queries-oracle.sql which contains the procedure to be called. I tried several ways to call it:
EXEC schema_name.procedure_name :param1, :param2, :param3;
EXEC schema_name.procedure_name(:param1, :param2, :param3);
BEGIN EXEC schema_name.procedure_name :param1, :param2, :param3; END;
BEGIN schema_name.procedure_name :param1, :param2, :param3; END;
All these have a :name through which they are called. Which I'm now trying from a REPL.
The result of these tries is:
Invalid SQL-Statement
Invalid SQL-Statement
Encountered the symbol "schema_name" when expecting one of the follwing:...
#:next.jdbc{:update-count -1}

Connecting a db2 database from a centos hosted laravel application

I'm trying to connect to a db2 database server (iseries ibm) from my laravel application (5.8). The application is running on a centos linux server.
I saw that db2 isn't in the 4 databases types listed here : https://laravel.com/docs/5.8/database#introduction.
So I tried to use that package https://github.com/cooperl22/laravel-db2 but I got the followings errors :
Undefined class constant 'I5_ATTR_DBC_SYS_NAMING'
And I've got the errors for 5 constants :
PDO::I5_ATTR_DBC_SYS_NAMING, PDO::I5_ATTR_COMMIT, PDO::I5_ATTR_JOB_SORT, PDO::I5_ATTR_DBC_LIBL, PDO::I5_ATTR_DBC_CURLIB.
Also, if I comment theses constants, I got this error :
`Syntax error: -104 [IBM][CLI Driver][AS] SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "( + - ? : DAY INF NAN RID ROW RRN". SQLSTATE=42601 (SQLNumResultCols[-104] at /root/PDO_IBM-1.3.6/ibm_driver.c:153) (SQL: select * from )`
I'm using the db2_ibmi_ibm driver.
Here is my php info linked to the driver :
EDITED :
php version is 7.3.4
centos version is 7
Also I made a from scratch php script running and I can get the results from a query using the db2_connection method. So I'm pretty sure it's PDO related :-/
Ok I found the issue, my scheme and database were wrong, so the query wasn't correct.
The PDO constants are not needed in my case.
Thanks for your answers

PL/SQL on SquirreL SQL Client 3.7.1

I was trying to execute PL/SQL scripts on SQuirrel but it doesn't seem to work.
I configured Oracle Thin Driver by adding ojdbc7.jar on "Extra Class Path", was able to connect to the database but when tried to run a simple code it gives an error:
-- code
BEGIN
dbms_output.put_line('Hello World');
END;
/
-- error
Error: ORA-06550: line 2, column 37:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
:= . ( % ;
SQLState: 65000
ErrorCode: 6550
Error occurred in:
BEGIN
dbms_output.put_line('Hello World')
Am I doing anything wrong?
This statement worked for me (the / is necessary for SQuirrel SQL Client):
BEGIN
dbms_output.put_line('Hello World');
END;
/
However, you won't see the output in the usual Results tab. You need to open the Oracle Database Output window. As far as I can see you can only open it with a button on the toolbar. You'll also need to enable auto refresh or manually refresh the output.
can you try this:
BEGIN
dbms_output.put_line('Hello World');
END;
by removing /
When installing the SQuirreL, try including the Oracle Plugin. This works for me in version 3.8.1.
Oracle plugin for Squirrel is needed for executing queries in BEGIN - END;
Had the same problem untill reinstalled squirrel with Oracle plugin.

Oracle problems with dbms_xmlgen package

I have a weird problem with dbms_xmlgen package in Oracle 10g.
Here's my situation:
Queries using this package usually work as expected, without issues.
I.E.:
SQL> select dbms_xmlgen.getXML('select 1 from dual') from dual;
DBMS_XMLGEN.GETXML('SELECT1FRO
--------------------------------------------------------------------------------
<?xml version="1.0"?>
<ROWSET>
<ROW>
<_x0031_>1</_x0031_>
</ROW>
</ROWSET>
However, yesterday afternoon, they (the queries using dbms_xmlgen package) stopped working at all with the following error:
ORA-06544: PL/SQL: internal error, arguments: [pef.c:pefpargs2()], [30], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [pef.c:pefpargs2()]
ORA-06512: at "SYS.DBMS_XMLGEN", line 229
ORA-06512: at "SYS.DBMS_XMLGEN", line 175
Rebooting Oracle server fixed the issue.
The thing is, we are relying on this feature for a couple of integration features we are about to deploy, and I don't want to have unexpected problems when we're on production environment.
Any ideas/patches/experiences on the same issue?
Here's Oracle version we're using (select * from v$version):
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Have not found anything about that error. You can try to:
Ensure that server process have not been killed in the background by
checking alert_.log for more info on internal error, and in the trace files referenced there.
Less probable causes:
Check if you have special data like '<' or unicode chars that will be output.
Check your database and client character set.
Oracle "internal error" are internal errors..and as such can only be properly diagnosed by Oracle.
your best option is to contact Oracle support.

Resources