Porting application which uses Oracle mod_plsql to PostgreSQL - oracle

I need to port an application that uses Oracle mod_plsql to PostgreSQL. Currently database procedures are called over HTTP with the use of Apache + mod_plsql. The procedures are easily ported to PostgreSQL, but I can not find a replacement for the Apache + mod_plsql part. Does anybody have any experience on ho to do it and what to use?
UPDATE (to make stuff more clear):
See: http://docs.oracle.com/cd/B14099_19/web.1012/b14010/concept.htm for how mod_plsql work.
What I need is a way to call a function on postgrsql as:
protocol://hostname[:port]/DAD_location/[[!][schema.][package.]proc_name[?query_string]]
ei:
http://www.acme.com:9000/pls/mydad/mypackage.myproc?a=v&b=1

You could fork my NodeJS based implementation of web_plsql as a starting point and "simply" replace the Oracle access with PostgreSQL.
You should be able to use pretty much all of the logic in NodeJS and only need to change the way how the code interacts with the database in the oracle.js module.

Related

Using HTP.P in ATP oracle database

I've just started checking out the ATP database in oracles cloud.
I have an old pl/sql proc that I want to put on the ATP database.
Happily the procedure with calls to htp.p compiled with no errors...but how do I find the URL to use to get to my procedure?
(And BTW no the proc isn't something that can just be converted into a restful web service through apex.)
The answer I've gone with for this is that the ATP database comes with ORDS configuired and ready to use.
You can expose pl/sql procedures to requests through ORDS. This does require some manual work for each procedure but not a huge amount.
You will need to set up a module in ORDS and a template for each get/put etc call you want to send through to your procedure.
Its documented pretty well here:
https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-remote-procedure-call-rpc-and-output-parameters
This is using the command line for everything - I've found it easier to use the restful data services available through apex to get a GUI interface to use to set this up. I believe there is a GUI available through sql developer too.

Oracle database - use external Java

I'm looking to find a way how to use higher versions of Java (1.6,1.7,...) instead of Java 1.4 which is available for Java stored procedures in a Oracle 10g.
I'm thinking about deploying a GlassFish server on the database server, and deploy web applications which functionalities would I use by calling them from PL/SQL.
Reasons for using Java instead of PL/SQL would be communications with various devices, calling and deploying web services, text processing...
Does anybody have a better, simpler idea on how to use higher version Java from PL/SQL in Oracle 10g database?
Forget about that. There used to be something called Jserver several years ago, but it was abandoned by Oracle. Theoretically you could use Oracle ver 12c which uses JVM ver 1.6. But even this JVM is slightly different. For example it's GC can kill threads when they are not bound to a "live" DB connection. So you may encounter various interesting problems.
There is no way how to "upgrade" JVM inside current Oracle DB installation.

Using Oracle database with CakePHP 2.0

I have noticed there's no datasource for Oracle in CakePHP 2.0 for the moment, although it seems they are working on in it now: http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0
There are some people explaining how to use an Oracle DB adapting some code from CakePHP 1.3:
http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/
http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/
But I'm not sure that's the correct way. If it was so simple, they would have released the feature already for CakePHP 2.X...
Would I have any trouble using that "cheat"?
I want to connect CakePHP with PL/SQL procedures and a desktop application and they are working over Oracle. I can not change that.
After asking some CakePHP developers I came out with the conclusion that it is not possible to use an Oracle Database with CakePHP 2.3 if you want to make a proper use of CakePHP Models and their query syntax. There's no yet available any driver for Oracle in CakePHP which is completely functional.
Therefore, the solution I found was to use the OCI8 Functions of PHP.
Like this i could use oci_parse to directly query against the DB or rather call a PL-SQL procedure which is what I finally decided to do. (because of the sql functions complexity and the division of task inside my work group)
Now, I can not make use of many of the advantages of using CakePHP models, but It was the only way.
There is a new CakePHP 3 Driver for Oracle Database released (MIT) and working with Oracle 11g and Oracle 12c databases. Some features:
Triggers
Sequences
Cursors
Stored procedures
Packages
All the basic CRUD features to allow select/insert/update/delete rows.
CakePHP Pagination
CakePHP Bake code generation
Check the Documentation here, and the release announcement here.

What is an Oracle Client?

I'm from MySQL background and am new to Oracle. I want to know
What is meant by Oracle Client?
What is its use?
What is its equivalent in MySQL ?
Thanks
What is meant by Oracle Client?
and
What is its use?
In this context, a client is a class library (DLL) that allows you to connect remotely to the underlying database of an application. A client, always within the same context, can also be called a .NET Data Provider.
You may have multiple data providers based on the underlying database engine with which you're working.
There was System.Data.OracleClient (deprecated), provided by Microsoft.
There is Oracle.Data.Client, which is actually the best ever built Oracle Client, or Oracle .NET Data Provider. You may also download the latest Oracle 11g Data Provider for .NET.
So, when accessing the Oracle underlying database, make sure your work with this provider, proper for your version of Oracle, and start doing ADO.NET with your favorite database! =P
There are also some other tools that you can work with that will ease your data access code pain, such as Enterprise Library or NHibernate, both are frameworks to basically accessing databases.
Enterprise Library can do even more then that!
And NHibernate is an ORM (Object/Relation Mapping) tool that can work just very fine with Oracle.
Remember though, always use Oracle.Data.Client namespace in the Oracle.DataAccess.dll assembly.
What is its equivalent in MySQL ?
As the equivalence for MySQL, I guess it would be MySQL Connector/NET.
It is the Oracle binaries installed that allow communication with the Oracle database. It can be using SQL*Plus, JDBC (type II or IV) or OCI (Oracle Call Interface).
Its a piece of software that allows a remote computer to talk to Oracle. If you were to write a piece of software that communicated with the database, you would use the Oracle Client to facilitate that communication

How can I do Exp and Imp by using PL/SQL

How can I do Exp and Imp by using PL/SQL?
This could be done in a few ways.
First, if you're using 10g or later, you can consider using data pump (expdp and impdp) as opposed to imp and exp. These are the newer and more capable versions of those tools.
As for how to call them from PL/SQL, you can do so by:
You can make an external procedure call to a DLL (or shared library if you're on UNIX)
you could write a simple Java class (to run in the Oracle JVM) that would call out using Java
you could use Advanced Queues or DBMS_PIPE to communicate with external applications
You could use UTL_TCP to interact over the network (e.g. SOAP)
In 10g, you could use the DBMS_SCHEDULER package to call OS commands
The first and last options should be well documented in the Oracle online docs - the other two options would require a little more coordination and coding.
If you are using impdp/expdp - Datapump (10g or later) - , you can simply use DBMS_DATAPUMP:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_datpmp.htm
You can see an example about exactly you are requesting in the Examples of Using the Data Pump API inside the Oracle Database Utilities book.

Resources