Forum Stats

  • 3,769,232 Users
  • 2,252,934 Discussions
  • 7,874,951 Comments

Discussions

Oracle Datalink error in Java CallableStatement

User_19BPU
User_19BPU Member Posts: 1,086 Blue Ribbon

Hi,

  I am invoking a Stored Procedure from Java callable statement this procedure is using a data link to connect to a remote schema , when I invoke the procedure in TOAD it is working fine. But through Java , I am getting the below error:-

ORA-04052: error occurred when looking up remote object [email protected]_LINK.IBM.COM

Below is the datalink created in the DB.

CREATE PUBLIC DATABASE LINK "TESTA_LINK"

   CONNECT TO "PROD_TESTA" IDENTIFIED BY VALUES '055CBE575E7394622E642F389DD59F7F75973C2A781FB11B08'

   USING 'localhost:1521/orcl';

Please let me know what is the issue here?

Thanks

Tagged:

Answers

  • Unknown
    edited Oct 14, 2015 8:01PM
       I am invoking a Stored Procedure from Java callable statement this procedure is using a data link to connect to a remote schema , when I invoke the procedure in TOAD it is working fine. But through Java , I am getting the below error:-
    
    
     ORA-04052: error occurred when looking up remote object [email protected]_LINK.IBM.COM
    
    

    Are you sure that is the ONLY exception you are getting?

    Generally there will be a couple of other related exceptions. One of the related ones is often an invalid username/password exception.,

    Post ALL of the exceptions you got.

    Are you using the SAME credentials in toad when it works there? That is, same username, password and database?

    Is that toad on the SAME machine you run the Java test on?

    A better test, rather than toad is to use sql*plus and see if the procedure executes correctly.

    The likely causes are:

    1. the credentials used in the link aren't valid

    2. the credentials used to execute the procedure aren't valid

    3. the privileges required by the procedure have been granted thru a role rather than granted directly

    Roles are DISABLED in named, PL/SQL blocks which use the default DEFINER rights.

This discussion has been closed.