Calling Stored Procedure using db link from different schema - oracle

We have oracle database and created a db link in one schema "Owner". We also have a stored procedure which is using this db link to connect to remote procedure.
When calling this stored procedure with "Owner" credentials, it is working fine.
However, when we try to execute using "USER" credentials, it is not working. Throwing this error:
ORA-02049: timeout: distributed transaction waiting for lock
Thanks,

Related

Oracle - unable to create DB link

I am unable to create the DB link as it's throwing ORA - 01031 insufficient privileges error.
Let's say I have database DB1 and schema name as s1 and second database as DB2 with schema t1.
I am trying to create the DB link by sysdba user by running below -
alter session set current_schema=s1;
Create database_link dblinkname connect to t1 identified by password using DB2;
But this is giving me error. I tried giving privileges also to s1 but no luck. Any leads. I don't have the schema password for s1 and I can't reset it as it's production environment.
I had the same issue a several years ago.
Assuming, you don't want to create a public database link...
You can do this:
Grant privilege create database link to target schema.
Create a stored procedure in your target schema, which creates database link per execute immediate
Call this procedure
Finally drop this procedure.

Call existing PL/SQL procedure inside Java application and get data from Oracle database

I configured the jndi datasource and connected to the Oracle database, now I want to call the existing procedure named exampleProcedure that is stored there to fetch the data. I found this stackoverflow question that may be related to my issue, but how to store the incoming data?

ODI procedure for calling a stored procedure for delete doesn't work when started with the ODI agent

I have created a stored PL/SQL procedure on the DB which needs to delete rows with certain conditions. It is called by an ODI12c procedure, code is in the 'target code' section and is without any parameters:
BEGIN
schema.delete_from_tables;
END;
When I run it through ODI with the ODI agent, it finishes successfully in the operator, but doesn't actually delete the records.
But when I call the same procedure through ODI but with the local agent, it deletes the records; so does when I call it directly in the database.
The user through which the agent makes the connection is the same with which I log in the DB.
Autocommit is 'on', but there's also COMMIT in the stored procedure itself.
The user of the ODI master repository was also granted DELETE on all tables; the agent was restarted - no change.
As a comparison - there are other existing truncate procedures, stored in the same schema and called in the same way through the ODI agent and they work.
Any other suggestions would be helpful, thanks!

Lost permissions to tables after turning on SQL authorization in Apache Derby

The database created in Java DB (Derby) was set-up as follows to allow authentication and authorization:
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.connection.requireAuthentication','true');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.user.normal', 'normal');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.fullAccessUsers', 'sa');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.readOnlyAccessUsers', 'normal');
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.defaultConnectionMode', 'readOnlyAccess');
The "sa" username was created during database creation so it is the owner of the database.
And this works as intended. I can log in as "sa" user and have full access. Or log in as "normal" users and be restricted to read only access.
Now, I want to use SQL authorization to grant specific permissions to specific users.
To do this I have to switch on SQL authorization first by executing following command:
CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.database.sqlAuthorization', 'true');
Problem is, that after login in again under "sa" the system reports that I have no rights for SELECT and other statements. Moreover I loose complete ownership on the database.
Why Derby suddenly denies access to any user including the owner after executing the statement that switches on the SQL authorization?
P.S. I use Apache Derby Network Server - 10.9.1.0 which was a part of Java EE 7 installation for NetBeans 7.3
P.S 2. When after SQL authorization is set to true I try to use GRANT statement I receive following SQL error code:
SQL state 42506: User 'SA' is not the owner of Table/View 'SA'.'DOCTYPES'.
Even though the whole database was created using this username.

How to create a database in Oracle using JDBC?

I want to create a new database on an Oracle server via JDBC. I cannot seem to connect to the database without providing an SID: using a URL like jdbc:oracle:thin:#//[IP]:1521 results in an error of "ORA-12504, TNS:listener was not given the SID in CONNECT_DATA"
Alternatively, if I log into a specific SID, I can run most DDL commands except for CREATE DATABASE foo which fails with an error of "ORA-01100: database already mounted"
How am I supposed to create a database if I cannot connect to the server without specifying a specific database and cannot create a database if I am already logged into a specific database?
AFAIK creating a database needs an internal and direct connection which can only be done by logging in directly on the server (normally a user account called 'oracle').
One reason for that: users are stored in the database itself. No database = no user to connect to by an external client.
Please also note Justin's comment about oracles database schemas. This is probably what you are looking for
What you need are following commands:
CREATE TABLESPACE CREATE USER and few GRANT ... TO ... -- to have rights to connect and create objects, at least

Resources