[DB-SIG] Re: python module as external library for Oracle?

Anthony Tuininga anthony@computronix.com
Wed, 12 Feb 2003 09:48:13 -0700


Not too fast! You can embed Python in a C program quite well. That is
the means used for freezing programs, for example.

On Wed, 2003-02-12 at 06:47, Andy Todd wrote:
> On Tue, Feb 11, 2003 at 02:35:54PM -0800, Mike Rovner wrote:
> > "Simon Saubern" <simon.saubern@molsci.csiro.au> wrote in message
> > news:p05100306ba6e34332d8d@
> > >
> > > I'd like to set-up a trigger within Oracle that would call an
> > > external library to do some calculations on new rows inserted into
> > > Oracle tables.
> > >
> > > Can this external library be a python script, or do I have to compile
> > > the python code into C? If so, how do I go about doing that?
> > 
> > AFAIK since Oracle8 on Windows platform there is a possibility to call
> > arbitrary OCX from within PLSQL code.
> > You can utilize that for python binding.
> > 
> > On the other hand that solution is not portable and as Oracle itself
> > mentioned not so stable to recommend it. ;)
> > 
> > Or you can use jython.
> > 
> > Best wishes,
> > Mike
> > 
> > PS. I wish I could use python instead of java for oracle scripting.
> > 
> > 
> > 
> 
> According to Chapter 10 of the Oracle Application Developer's Guide;
> 
> """
> Oracle lets you work in different languages:
>  - PL/SQL 
>  - C, by means of the Oracle Call Interface (OCI)
>  - C or C++, by means of the Pro*C/C++ precompiler
>  - COBOL, by means of the Pro*COBOL precompiler
>  - Visual Basic, by means of Oracle Objects for OLE (OO4O)
>  - Java, by means of the JDBC Application Programmers Interface (API)
> """
> If you have a technet account you can view it at;
> 
> http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg11rtn.htm
> 
> So the answer to your question is no. If you want to do it synchronously. 
> 
> If you don't absolutely definitely need the trigger and just want to periodically process the data then I'd suggest a Python script triggered by cron (or other system specific scheduler, e.g. AT on Windows). Otherwise you are stuck I'm afraid.
> 
> Its a useful rule of thumb that Oracle works well within Oracle but doesn't interact well with the outside world. Mainly because it *is* a multi platform database.
> 
> Regards,
> Andy
-- 
Anthony Tuininga <anthony@computronix.com>