dbTalk Databases Forums  

java in the database (10gR2 & 11gR2)

comp.databases.oracle.server comp.databases.oracle.server


Discuss java in the database (10gR2 & 11gR2) in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeremy
 
Posts: n/a

Default java in the database (10gR2 & 11gR2) - 02-05-2011 , 05:44 AM






Hi

This is on 10gR2 / 11gR2

We have a simple "hello world" type java proc in the database which we
can access via a pl/sql wrapper - works fine.

Ouside of the database, we downloaded some java code (lets call it jc)
which provides methods for interacting with a specific web service. We
wrote a simple harness in a Java IDE and this works perfectly.

So far so good.

Now we want to be able to run jc from pl/sql.

So I think the logical thing to do is to load the jc code into the
database.

However as soon as we try to run our harness (which we also compiled
into the db and we know executes without any references to jc) we get
errors.

At this point I am aware that it is customary to add details of code
samples and the error messages we received - I do not have these to hand
and in fact that is not really the question....

Because the question is: are there any specific stpes that need to be
taken to enable (any) jc we load into the db to be able to access for
example lower-level stuff like utl_http for example? Are there any
difference between 10g and 11g in this respect (as we will need to make
this work in both versions)?

The schema into which we loaded jc and are working is able to
successfully execute (from within pl/sql) UTL_HTTP and get responses
from remote servers.

Thanks for any pointers.

--
jeremy

Reply With Quote
  #2  
Old   
bdbafh
 
Posts: n/a

Default Re: java in the database (10gR2 & 11gR2) - 02-05-2011 , 06:41 AM






On Feb 5, 6:44*am, Jeremy <jeremy0... (AT) gmail (DOT) com> wrote:
Quote:
Hi

This is on 10gR2 / 11gR2

We have a simple "hello world" type java proc in the database which we
can access via a pl/sql wrapper - works fine.

Ouside of the database, we downloaded some java code (lets call it jc)
which provides methods for interacting with a specific web service. We
wrote a simple harness in a Java IDE and this works perfectly.

So far so good.

Now we want to be able to run jc from pl/sql.

So I think the logical thing to do is to load the jc code into the
database.

However as soon as we try to run our harness (which we also compiled
into the db and we know executes without any references to jc) we get
errors.

At this point I am aware that it is customary to add details of code
samples and the error messages we received - I do not have these to hand
and in fact that is not really the question....

Because the question is: are there any specific stpes that need to be
taken to enable (any) jc we load into the db to be able to access for
example lower-level stuff like utl_http for example? Are there any
difference between 10g and 11g in this respect (as we will need to make
this work in both versions)?

The schema into which we loaded jc and are working is able to
successfully execute (from within pl/sql) UTL_HTTP and get responses
from remote servers.

Thanks for any pointers.

--
jeremy
Jeremy,

Quote:
Are there any
difference between 10g and 11g in this respect (as we will need to make
this work in both versions)?
Part of upgrading a database to 11g (11.2.0.2 at this point) is to
create access control lists for the UTL packages, i.e. UTL_SMTP using
the package DBMS_NETWORK_ACL_ADMIN.
http://www.oracle-base.com/articles/...ices_11gR1.php

This would not likely have affected 10g R2, but possibly it was
backported into the 10.2.0.5 patchset?
You might want to list more detailed version info.

hth.

-bdbafh

Reply With Quote
  #3  
Old   
Jeremy
 
Posts: n/a

Default Re: java in the database (10gR2 & 11gR2) - 02-05-2011 , 09:25 AM



In article <3497fa16-854d-40b2-becb-
a1cca3cf445b (AT) j11g2000yqh (DOT) googlegroups.com>, bdbafh (AT) gmail (DOT) com says...
Quote:
Jeremy,

Are there any
difference between 10g and 11g in this respect (as we will need to make
this work in both versions)?

Part of upgrading a database to 11g (11.2.0.2 at this point) is to
create access control lists for the UTL packages, i.e. UTL_SMTP using
the package DBMS_NETWORK_ACL_ADMIN.
http://www.oracle-base.com/articles/...ices_11gR1.php

This would not likely have affected 10g R2, but possibly it was
backported into the 10.2.0.5 patchset?
You might want to list more detailed version info.

Thanks for that - DB in which we are evaluating "jc" is running
11.2.0.1.0 on Windows Server 2003.

We are able to access e.g. utl_smtp and utl_http from within PL/SQL no
problems there.

Question really at this stage is whether there are any explicit access
rights that need to be granted in order for java code to be able to
access these kinds of network functions.


--
jeremy

Reply With Quote
  #4  
Old   
Gerard H. Pille
 
Posts: n/a

Default Re: java in the database (10gR2 & 11gR2) - 02-07-2011 , 12:33 PM



For java code, even within the database, to call pl/sql packages, it would need to connect to
the database. The account it uses to connect, would need to have execute rights on those
"low-level" (???) packages.

But why would you put java inside the database and then try to call pl/sql functions in stead of
using a java http client??

Reply With Quote
  #5  
Old   
Jeremy
 
Posts: n/a

Default Re: java in the database (10gR2 & 11gR2) - 02-07-2011 , 01:38 PM



In article <4d503b1e$0$14263$ba620e4c (AT) news (DOT) skynet.be>, ghp (AT) skynet (DOT) be
says...
Quote:
For java code, even within the database, to call pl/sql packages, it would need to connect to
the database. The account it uses to connect, would need to have execute rights on those
"low-level" (???) packages.

But why would you put java inside the database and then try to call pl/sql functions in stead of
using a java http client??
Hi other way around - we want to call java from pl/sql - and it seemed
sensible (?) to put the java in the database as well.

So our app is written in pl/sql. There are some features in an SDK
written in java which will enable our pl/sql to interact with certain
services accessed over the internet.

--
jeremy

Reply With Quote
  #6  
Old   
Thomas Olszewicki
 
Posts: n/a

Default Re: java in the database (10gR2 & 11gR2) - 02-07-2011 , 04:30 PM



On Feb 5, 10:25*am, Jeremy <jeremy0... (AT) gmail (DOT) com> wrote:
Quote:
In article <3497fa16-854d-40b2-becb-
a1cca3cf4... (AT) j11g2000yqh (DOT) googlegroups.com>, bdb... (AT) gmail (DOT) com says...

Jeremy,

Are there any
difference between 10g and 11g in this respect (as we will need to make
this work in both versions)?

Part of upgrading a database to 11g (11.2.0.2 at this point) is to
create access control lists for the UTL packages, i.e. UTL_SMTP using
the package DBMS_NETWORK_ACL_ADMIN.
http://www.oracle-base.com/articles/...ssToNetworkSer...

This would not likely have affected 10g R2, but possibly it was
backported into the 10.2.0.5 patchset?
You might want to list more detailed version info.

Thanks for that - DB in which we are evaluating "jc" is running
11.2.0.1.0 on Windows Server 2003.

We are able to access e.g. utl_smtp and utl_http from within PL/SQL no
problems there.

Question really at this stage is whether there are any explicit access
rights that need to be granted in order for java code to be able to
access these kinds of network functions.

--
jeremy
Jeremy,
Oracle 11g r2 has introduced many new security requirements.
You may need also to "grand" Java classes access to specific internet
resources:
Example:
dbms_java.grant_permission( <Your Schema>,
'SYS:java.net.SocketPermission', '127.0.0.1:9999',
'connect,resolve' );
Change 'SYS:java.net.SocketPermission' to the class name used to
access internet.
Change '127.0.0.1:9999' to the ip or url required.
Look at this explanation:
http://download.oracle.com/docs/cd/E...n.htm#BABFBDGG


hth
Thomas

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.