Java Invokeing inside pl/sql

Dear Experts,

I wrote the following java program

import java.sql. *;
import java. IO;
Oracle.jdbc import. *;

public class oracle_java_sync
{
Public Shared Sub insertion_via_java (whole deptno,
Dnom chain,
String pass)
throws SQLException
{
String sql = "INSERT INTO DEPT VALUES (?,?,?)"; "
Try
{
Connection Conn is DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "Tiger");.
conn.setAutoCommit (false);
PreparedStatement myStatement = conn.prepareStatement (sql);
myStatement.setInt (1, deptno);
myStatement.setString (2, dname);
myStatement.setString (3, loc);
myStatement.executeUpdate ();
myStatement.close ();
}
catch (SQLException e)
{
System.Err.println (e.getMessage ());
}
}
}

After that, I did the following steps
step 1 > Compilation
D:\STUDY\play_with_java > javac oracle_java_sync.java

step 2 > loading
D:\STUDY\play_with_java > loadjava u scott/talkative tiger@ORCL-oracle_java_sync.java
arguments: '-u' 'scott/***@ORCL' '-verbose' "oracle_java_sync.java".
creation: source oracle_java_sync
loading: source oracle_java_sync
Loaded classes: 0
Resources: 0
Load of sources: 1
Published Interfaces: 0
The generated classes: 0
Classes ignored: 0
The synonyms created: 0
Errors: 0

step 3 > call and appeal
D:\STUDY\play_with_java > sqlplus

SQL * more: Production release 11.2.0.1.0 on Sun Oct 14 13:01:30 2012

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Enter the user name: scott
Enter the password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options

SQL > create or replace
procedure insertdeptnoviajava (deptno number 2,
3 dname VARCHAR2,
loc 4 VARCHAR2
5)
6 AS
JAVA 7 language
8 name "oracle_java_sync.insertion_via_java (java.lang.String, java.lang.Integer, java.lang.String)";
9.

Created procedure.

SQL > CALL insertdeptnoviajava (25, 'Manufacturing', 'Kolkata');

Calls made.

SQL > START
2 insertdeptnoviajava(25,'Manufacturing','Kolkata');
3 VALIDATION;
4 END;
5.

After this stage the system is unresponsive.
The cursor blinks but nothing happens.

Could you please suggest where something went wrong.

Concerning
Mehdi Bhattacharya

Hi René,.

I think that this forum should be better for this kind of issues: Java in the Oracle database.

Coming to your problem, there are several errors.
Why not try to create the java class in Eclipse or Netbeans? Usually this may help you.

I have your java class, this line:

 public static void insertion_via_java(Integer deptno,

should be replaced by

 public static void insertion_via_java(int deptno,

Also, you should validate your transaction somewhere:

myStatement.executeUpdate();
myStatement.close();
conn.commit();

Then change your Java stored procedure to reflect the proper types by calling the method (int, java.lang.Integer not):

CREATE OR REPLACE PROCEDURE insertdeptnoviajava (
   deptno          NUMBER
 , dname           VARCHAR2
 , loc             VARCHAR2)
AS
   LANGUAGE JAVA
   NAME 'oracle_java_sync.insertion_via_java(int,java.lang.String,java.lang.String)';
/

Kind regards.
Al

Tags: Database

Similar Questions

  • How to initialize the Java variable within pl/sql block in the ODi procedure

    I have a step in the procedure of odi that using oracle technology.

    I want to initialize the java variable inside that.

    Please help me for this.

    < @ if (odiRef.getOption ("USE_PUBADMIN_PARAM_TABLE").equals("1")) {@ >}

    DENIZ

    EH_FAILURE_MESSAGE_TEXT VARCHAR2 (4000);

    EH_FIXED_VERSION VARCHAR2 (4000);

    EH_ISSUE_TYPE VARCHAR2 (4000);

    EH_PRIORITY VARCHAR2 (4000);

    EH_SUMMARY VARCHAR2 (4000);

    EH_DESCRIPTION VARCHAR2 (4000);

    EH_PROJECT_ID VARCHAR2 (4000);

    EH_COMPONENT VARCHAR2 (4000);

    EH_AFFECTED_VERSION VARCHAR2 (4000);

    EH_CUSTOMPROPXML VARCHAR2 (4000);

    EH_LOG_JIRA VARCHAR2 (4000);

    EH_CONTINUE_ON_ERROR VARCHAR2 (4000);

    EH_SEND_MAIL_NOTIFICATION VARCHAR2 (4000);

    EH_NOTIFICATION_RECIPENTS VARCHAR2 (4000);

    EH_JIRAJARPATH VARCHAR2 (4000);

    BEGIN

    SELECT

    DECODE ('< % = odiRef.getOption ("FAILURE_MESSAGE_TEXT") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_FAILURE_MESSAGE_TEXT'),' < % = odiRef.getOption ("FAILURE_MESSAGE_TEXT") % >") IN EH_FAILURE_MESSAGE_TEXT.

    DECODE ('< % = odiRef.getOption ("FIXED_VERSION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_FIXED_VERSION'),' < % = odiRef.getOption ("FIXED_VERSION") % >") IN EH_FIXED_VERSION.

    DECODE ('< % = odiRef.getOption ("ISSUE_TYPE") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_ISSUE_TYPE'),' < % = odiRef.getOption ("ISSUE_TYPE") % >") IN EH_ISSUE_TYPE.

    DECODE ('< % = odiRef.getOption ("PRIORITY") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_PRIORITY'),' < % = odiRef.getOption ("PRIORITY") % >") IN EH_PRIORITY.

    DECODE ('< % = odiRef.getOption ("SUMMARY") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_SUMMARY'),' < % = odiRef.getOption ("SUMMARY") % >") IN EH_SUMMARY.

    DECODE ('< % = odiRef.getOption ("DESCRIPTION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_DESCRIPTION'),' < % = odiRef.getOption ('DESCRIPTION') % >") IN EH_DESCRIPTION.

    DECODE ('< % = odiRef.getOption ("project") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_PROJECT_ID'),' < % = odiRef.getOption ("project") % >") IN EH_PROJECT_ID.

    DECODE ('< % = odiRef.getOption ("ELEMENT") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_COMPONENT'),' < % = odiRef.getOption ('ELEMENT') % >") IN EH_COMPONENT.

    DECODE ('< % = odiRef.getOption ("AFFECTED_VERSION") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_AFFECTED_VERSION'),' < % = odiRef.getOption ("AFFECTED_VERSION") % >") IN EH_AFFECTED_VERSION.

    DECODE ('< % = odiRef.getOption ("CUSTOMPROPXML") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_CUSTOMPROPXML'),' < % = odiRef.getOption ("CUSTOMPROPXML") % >") IN EH_CUSTOMPROPXML.

    DECODE ('< % = odiRef.getOption ("LOG_JIRA") % >', '0', PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_LOG_JIRA'),' < % = odiRef.getOption ("LOG_JIRA") % >") IN EH_LOG_JIRA.

    Decode('%=odiRef.GetOption("CONTINUE_ON_ERROR") % > ', '0', PBA_PARAM_PKG. ("GET_PARAMETER ('EH_CONTINUE_ON_ERROR'),' < % = odiRef.getOption ("CONTINUE_ON_ERROR") % >") IN EH_CONTINUE_ON_ERROR.

    DECODE ('< % = odiRef.getOption ("SEND_MAIL_NOTIFICATION") % >', '0', PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_SEND_MAIL_NOTIFICATION'),' < % = odiRef.getOption ("SEND_MAIL_NOTIFICATION") % >") IN EH_SEND_MAIL_NOTIFICATION.

    DECODE ('< % = odiRef.getOption ("NOTIFICATION_RECIPENTS") % >', NULL, PBA_PARAM_PKG.) ("GET_PARAMETER ('EH_NOTIFICATION_RECIPENTS'),' < % = odiRef.getOption ("NOTIFICATION_RECIPENTS") % >") IN EH_NOTIFICATION_RECIPENTS.

    PBA_PARAM_PKG. GET_PARAMETER ('EH_JIRAJARPATH') IN EH_JIRAJARPATH

    Double;

    / * I want to start as it is below. idon't want to control user source and control target conecpt.

    Please help me to below concept.

    */

    < @.

    String V_EH_FAILURE_MESSAGE_TEXT = EH_FAILURE_MESSAGE_TEXT;

    String V_EH_FIXED_VERSION = EH_FIXED_VERSION;

    String V_EH_ISSUE_TYPE = EH_ISSUE_TYPE;

    String V_EH_PRIORITY = EH_PRIORITY;

    String V_EH_SUMMARY = EH_SUMMARY;

    String V_EH_DESCRIPTION = EH_DESCRIPTION;

    String V_EH_PROJECT_ID = EH_PROJECT_ID;

    String V_EH_COMPONENT = EH_COMPONENT;

    String V_EH_AFFECTED_VERSION = EH_AFFECTED_VERSION;

    String V_EH_CUSTOMPROPXML = EH_CUSTOMPROPXML;

    String V_EH_LOG_JIRA = EH_LOG_JIRA;

    String V_EH_CONTINUE_ON_ERROR = EH_CONTINUE_ON_ERROR;

    String V_EH_SEND_MAIL_NOTIFICATION = EH_SEND_MAIL_NOTIFICATION;

    String V_EH_NOTIFICATION_RECIPENTS = EH_NOTIFICATION_RECIPENTS;

    String V_EH_JIRAJARPATH = EH_JIRAJARPATH;

    @ >

    END;

    {< @} @ >

    I have corrected this problem. No need to search on that.

  • Can I use a variable of environment inside a *.sql file?

    Hello

    I want to create an external table.
    Then I use the command
    create or replace directory abc as "C:\folder"... within a sql file.

    Now, I want "C:\folder" way to be dynamic I use this path in many other places also inside the sql file. So I thought to create an environment variable and set this value. I tried using like %Path% but it gives error... where % PATH%=C:\folder.
    Can I use a variable of environment inside a *.sql file?
    But how to do it or is there another way.


    Thank you
    Olivier

    Published by: user11018268 on February 19, 2010 01:03

    You can use a variable substitution:

    SQL> accept basedir prompt "input the base dir:  "
    input the base dir:  c:\exp
    SQL> create or replace directory exp as '&basedir';
    old   1: create or replace directory exp as '&basedir'
    new   1: create or replace directory exp as 'c:\exp'
    
    Directory created.
    
    SQL> create or replace directory exp_data as '&basedir\data';
    old   1: create or replace directory exp_data as '&basedir\data'
    new   1: create or replace directory exp_data as 'c:\exp\data'
    
    Directory created.
    
    SQL> create or replace directory exp_log as '&basedir\log';
    old   1: create or replace directory exp_log as '&basedir\log'
    new   1: create or replace directory exp_log as 'c:\exp\log'
    
    Directory created.
    
    SQL> select DIRECTORY_NAME, DIRECTORY_PATH
      2  from dba_directories;
    
    DIRECTORY_NAME                 DIRECTORY_PATH
    ------------------------------ ------------------------------
    EXP_LOG                        c:\exp\log
    EXP                            c:\exp
    EXP_DATA                       c:\exp\data
    

    Max
    http://oracleitalia.WordPress.com

  • How to call external C/java code in pl/sql or sql?

    Mr President

    I'm a newbie, but I want to know how to call the external C/java code in pl/sql or sql?

    Embedded SQL to Oracle environment is called Pro * C.

  • Works Datapump inside the SQL worksheet...

    Hi all

    "running the following code inside the spreadsheet and he just spits ' anonymous block completed.

    *****************************

    Set scan off

    Set serveroutput on

    escape game off

    whenever sqlerror exit

    DECLARE

    number of H1;

    errorvarchar varchar2 (100): = "ERROR";

    tryGetStatus number: = 0;

    Start

    H1: = dbms_datapump.open (operation = > 'IMPORT', job_mode = > job_name 'FULL' = > 'IMPORT_JOB_SQLDEV_73', version = > 'COMPATIBLE');

    tryGetStatus: = 1;

    dbms_datapump.set_parallel (handle = > h1, degree = > 1);

    dbms_datapump.add_file (handle = > h1, filename = > 'IMPORTtest2.LOG', directory = > 'DATA_PUMP_DIR', filetype = > 3);

    dbms_datapump.set_parameter (handle = > h1, name = > 'KEEP_MASTER', value = > 0);

    dbms_datapump.add_file (handle = > h1, filename = > ' ORAEU_COPIED.) (DMP", directory = >"DATA_PUMP_DIR", filetype = > 1);

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\APT_SYS_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/APT_SYS_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\APT_SYS_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/APT_SYS_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATA_MART_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_MART_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATA_MART_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_MART_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > UPPER ('C:\ORACLE\ORADATA\ORCL/DATA_STORE_DATA01.) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_STORE_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATA_STORE_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_STORE_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\RNET2_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/RNET2_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\RNET2_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/RNET2_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATA_AMA_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_AMA_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATA_AMA_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATA_AMA_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATASERVICES_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATASERVICES_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\DATASERVICES_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/DATASERVICES_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\ARC_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/ARC_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\MCSS_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/MCSS_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\MCSS_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/MCSS_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\IPAS_DATA01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/IPAS_DATA01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\IPAS_IDX01.)) DBF'), value = > SUPERIOR ('/ rdsdbdata/db/ORAEU_A/file/IPAS_IDX01.) DBF'));

    dbms_datapump.metadata_remap (manage = > h1, name = > 'REMAP_DATAFILE', old_value = > SUPERIOR ('C:\ORACLE\ORADATA\ORCL\PFIZERCMS_DATA01.)) DBF "), value = >"

    dbms_datapump.set_parameter (handle = > h1, name = > 'INCLUDE_METADATA', value = > 1);

    dbms_datapump.set_parameter (handle = > h1, name = > 'DATA_ACCESS_METHOD', value = > "AUTOMATIC").

    dbms_datapump.set_parameter (handle = > h1, name = > 'REUSE_DATAFILES', value = > 0);

    dbms_datapump.set_parameter (handle = > h1, name = > 'TABLE_EXISTS_ACTION', value = > 'REPLACE');

    dbms_datapump.set_parameter (handle = > h1, name = > 'SKIP_UNUSABLE_INDEXES', value = > 0);

    dbms_datapump. START_JOB (handle = > h1, skip_current = > 0, abort_step = > 0);

    dbms_datapump. Detach (handle = > h1);

    errorvarchar: = "NO_ERROR"

    EXCEPTION

    WHILE OTHERS THEN

    BEGIN

    IF ((errorvarchar = ' ERROR') AND (tryGetStatus = 1)) THEN

    DBMS_DATAPUMP. Detach (H1);

    END IF;

    EXCEPTION

    WHILE OTHERS THEN

    NULL;

    END;

    LIFT;

    END;

    /

    *****************

    all entries are appreciated

    Thank you

    Please let me know if you see a code problem

    What is your question has to do with Sql Developer?

    Unless you can connect you must mark ANSWERED thread and repost it in Sql and Pl/Sql forum

    the Japan Government says:

    Hi Jeff

    I expect that it runs the import at least.

    Get this error now on line 66:

    EXCEPTION

    WHILE OTHERS THEN

    BEGIN

    IF ((errorvarchar = ' ERROR') AND (tryGetStatus = 1)) THEN

    DBMS_DATAPUMP. Detach (H1);

    END IF;

    EXCEPTION---> line 66

    WHILE OTHERS THEN

    NULL;

    END;

    When you repost you should post the EXACT code you use. The code you posted is NOT valid: you must also REMOVE the WHEN of OTHER or you can expect everyone to book you to INTENTIONALLY HIDE any exceptions that occur. Why do you NOT want to know if Oracle finds problems in your code? That makes NO sense at all.

    IF ((errorvarchar = ' ERROR') AND (tryGetStatus = 1)) THEN

    There is NO SPACE after the "and" what is garbage just as far as Oracle are concerned.

    Either you have posted an incorrect code or your code has syntax errors and will not compile or run anyway.

    I suggest that correct you your syntax errors before reposting in the Sql forum. If you have pain to find their delete ALL unnecessary code to reduce the problem to the example as SIMPLE as possible, until you find the code causing errors.

  • How can I get the exit code of a script .bat for Java back to PL/SQL?

    When you call a .bat script, only the exit code 1 returns. How can I get 7 back to the PL/SQL in the code example below?

    C:\Users\pwatson\src\java > type vv.sql

    set echo on

    -call dbms_java.grant_permission ('SYSTEM', 'SYS:java.io.FilePermission', '< < all FILES > >', 'run');

    HOME @EXIT/b ECHO 7 > vv.bat

    TYPE of HOST vv.bat

    CREATE OR REPLACE AND COMPILE THE SOURCES NAMED AS VV JAVA

    import of java.lang.Runtime;

    public class VV

    {

    public static int execute()

    survey java.io.IOException, java.lang.InterruptedException

    {

    int exitCode = 0;

    Duration rt = java.lang.Runtime.getRuntime ();

    Process proc = rt.exec ("cmd.exe /C v.bat 1 > NULL 2 > ZERO");

    proc.waitFor ();

    exitCode = proc.exitValue ();

    return exitCode;

    }

    }

    /

    CREATE OR REPLACE FUNCTION JavaRunShellCommand

    RETURN NUMBER

    IN THE JAVA LANGUAGE

    NAME 'VV.execute () return oracle.sql.NUMBER;

    /

    DISPLAY ERRORS

    NUMBER VARIABLE n;

    CALL JavaRunShellCommand() IN: n;

    PRINT n

    DISPLAY ERRORS

    SELECT JavaRunShellCommand() AS R FROM DUAL;

    DISPLAY ERRORS

    HOST DEL v.bat

    OUTPUT

    It is strange that there are no errors. If the Java code does not work, I would expect an exception. Without an exception in the code handler, I expect to be propagated all the way to the top of the call stack and be displayed by the client. But there is no exception.

    So that means, in my view, that there is nothing wrong with the code Java itself. He made the appeal successfully to run this external process. The fact that the external process falls down, is not an issue/error in Java.

    If this is the case, then the first thing that comes to mind, is that the Oracle (oracle.exe) process that is currently running, runs as a service of the o/s. And that the service will try to run a command through the command shell script. There may be a security or problem access here that prevents the oracle.exe running as a service to do this.

  • Java - functions and PL/SQL procedures?

    It is my understanding that Java can call stored PL/SQL and PL/SQL procedures and functions can call Java stored procedures and functions.

    The reason why I ask this is that my company is considering options on how to migrate our product. Our consultant said that PL/SQL cannot access Java procedures. I think they can. I am not well educated in the present, but I'm trying to learn as much as I can before we committed.

    Our graphical interface is written in Java, but they are still debating the back-end (lots of great transaction). Some think that it should be written in Java, some Java State itself would be too slow. I read the mantra of AskTom - SQL, PL/SQL, Java, and C.

    So, what's the scoop?

    What is the preference, or best practices?

    >
    It's the answer that confused me: PL/SQL cannot access Java procedures in an external JAVA virtual machine, but Oracle has its own JAVA virtual machine integrated in the database (except express edition).
    >
    Since I wrote it I'll try to explain it.

    Oracle, with the exception of the express edition, has a functionality integrated into the database (including the JVM) Java. You can import the java classes and jar files in the Oracle database and run Java code using the JAVA virtual machine, which is part of the Oracle.

    By "External JVM", I hear one application that is launched from the OS and Java Virtual Machine and it is a stand-alone process; in other words, not a part of the Oracle or Oracle of FMV at all.

    Both JVMs running in the 'sandbox' different and do not have access to each other code, classes, or process. Of course, they may be able to communicate using sockets, JNDI, EJBs and other features of wrapper, but they cannot access each other classes, instances of class or methods as they would if only there wasn't one JAVA virtual machine.

    So a stand-alone Java application can call stored procedures in Oracle (even those written in Java), Oracle PL/SQL procedures can call Java from Oracle procedures, Oracle Java procedures can call Oracle PL/SQL procedures. But procedures Oracle PL/SQL or Java can't call procedures or access to Classes or class instances that are part of an external JAVA virtual machine.

  • ODI, invoking a pl/sql procedure

    Hi all

    There is a pl/sql procedure written on the side of the target. Now how can I invoke this procedure through ODi without having to write the code in odi?
    is there any command for this?

    Kind regards
    Sourav

    Hello

    If you pl/sql procedure is met with success to your Oracle DB, then you can call the same procedure of ODI.
    Create an ODI procedure---> technology choose like ORACLE
    Choose your logic diagram so that it points to your Oracle Db accommodation that satisfies pl/sql procedure.

    Specify the following command

    Start
    ;
    end;

    Thank you
    Fati

  • How to navigate on Java Source in PL/SQL Developer

    As I use PL/SQL Developer for development, for the first time I just tried to write and compile a java source.
    After you have compiled the source of java successfully, I can see it by selecting it in the system table USER_SOURCE where it is defined as JAVA SOURCE TYPE, but I would like to know where and if it is possible to browse it in the list on the left of the window of the PL/SQL Developer Panel as it happens for the procedures Packages... I want to say is possible to change the source of java created without selecting USER_SOURCE but somehow better as it is possible to procedures in PL/SQL Developer?
    Thank you

    Yes, it is possible. Select Tools-> browser. Then in the browser you can find.

  • Not inside MS SQL SERVER Binn folder

    Hello

    In my 'C:\Program Files\Microsoft SQL Server\MSSQL", it is not Binn folder and also not in services when I run services.msc. Understand that the sqlserveragent.exe file is in the Binn folder. Where to get this Binn folder? How can I install MSSQL SERVER services? Help, please.

    Thank you

    Lynn

    Hi Lynn,

    For better assistance, we recommend that you post your query in SQL Server Integration Services Forum.
    See Forums SQL Server Integration Services

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Helps the recovery of value of the box apex inside pl/sql and to test whether a checkbox is checked/unchecked!

    I created a checkbox apex with three values. tell a v1, v2, v3.

    How can I get the values associated with the checkbox in pl - sql query and how to find if its cheked/unchecked in a pl - sql?

    something like:

    If: P1_V1.checked

    Insert into table1 (column1) value (: P1_V1. value())

    else if: P1_V2 checked

    Insert into table2 (column1) value (: P1_V2. value())

    on the other

    Insert into table2 (column1) value (: P1_V3. value())

    Thank you

    David

    1167377 wrote:

    Please update your forum profile with a recognisable username instead of "1167377": Video tutorial how to change username available

    Always include the information referred to in these guidelines when you ask a question: How to get the answers from the forum

    I created a checkbox apex with three values. tell a v1, v2, v3.

    How can I get the values associated with the checkbox in pl - sql query and how to find if its cheked/unchecked in a pl - sql?

    something like:

    If: P1_V1.checked

    Insert into table1 (column1) value (: P1_V1. value())

    else if: P1_V2 checked

    Insert into table2 (column1) value (: P1_V2. value())

    on the other

    Insert into table2 (column1) value (: P1_V3. value())

    On presentation element box will contain the values checked in a colon-delimited string:

    v1:v2:v3

    Checkbox element values are normally processed by converting the string bounded to an associative array, using the apex_util.string_to_table method of the API, and whatever it takes DML:

    declare
    
      checked_vals  apex_application_global.vc2_arr;
    
    begin
    
      checked_vals := apex_util.string_to_table(:p1_checkbox_item);
    
      forall i in checked_vals.first..checked_vals.last
        insert into foo
          (foo_id, foo_opt)
        values
          (:p1_foo_id, checked_vals(i));
    
    end;
    
  • How to display the current time inside the SQL prompt

    Hi all;

    I want to know how to set the time permanently in the SQL prompt.

    I'm running oracle database (10 g) on linux (5.5) machine.

    Thanks in advance.

    There under the name [g] login.sql file under ... sqlplus\admin (probably X:\xxx\product\11.2.0\client\sqlplus\admin), this file is executed whenever you connect to sqlplus. You may need to place ' set time on "in this file and save.

  • Quoted string inside dynamic SQL

    Hello
    My version of db: database Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    I run this code in a proc, and it goes to the exception block without running the code below:
    EXECUTE IMMEDIATE
        'SELECT LISTAGG (entitlement, '''','''') WITHIN GROUP (ORDER BY entitlement)
        FROM XMLTABLE (                                 
            ''''/ROWSET/ROW/ENTITLEMENTS/ENTITLEMENT''''      
            PASSING XMLPARSE (DOCUMENT p_xmldoc)        
            COLUMNS ENTITLEMENT VARCHAR2(30) PATH ''''.'''')'                                    
        INTO v_str;
    I made a mistake with quoted strings and I have tried different combinations, but anyway his does not work.
    THA real piece of code is below, whick I'm trying to run immediately in a string
    SELECT LISTAGG (entitlement, ',') WITHIN GROUP (ORDER BY entitlement)                              
                                            FROM XMLTABLE (                                 
                                                '/ROWSET/ROW/ENTITLEMENTS/ENTITLEMENT'      
                                                PASSING XMLPARSE (DOCUMENT p_xmldoc)        
                                                COLUMNS ENTITLEMENT VARCHAR2(30) PATH '.')
    p_xmldoc sample is less than
    '<?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <ENTITLEMENTS>
      <ENTITLEMENT>AMEX</ENTITLEMENT>
      <ENTITLEMENT>JCB</ENTITLEMENT>
    </ENTITLEMENTS>
    </ROW>
    </ROWSET>'
    My goal is to get
    v_str = AMEX, JCB
    Please advice.

    Hello

    Use the notation by Q.
    Assuming that the dynamic control does not contain a right brace immediately before a single quote, you can say:

    
    sql_txt := Q'{SELECT LISTAGG (entitlement, ',') WITHIN GROUP (ORDER BY entitlement) ...}';
    dbms_output.put_line (sql_txt || ' = sql_txt');
    -- EXECUTE IMMEDIATE sql_txt;
    

    With Q-rating, you can't excape double, or otherwise single quotes.

    When you write code dynamic SQL, put the full command in a single VARCHAR2 variable (such as the sql_txt above). During the test, display it. If it looks right, then a comment the line where actually run you it.

  • Problem to generate Java package PL SQL in Jdeveloper

    Hello

    I have problem to create the java class package PL SQL in JDeveloper.

    I use jdeveloper database navigator and right-click on a package and choose generate Java then in the Jpublisher window choose my controller view and accept other default values.

    I call methods in the generated class in the Action of a button in my JSP page, but when I click the button it throws null pointer exception! I Fund one of the generated method return null and it lead to this exception.

    protected DefaultContext __tx = null;

    public DefaultContext getConnectionContext() throws SQLException {}

    If (__tx == null) {}

    __tx = (getConnection () == null)? DefaultContext.getDefaultContext (): new DefaultContext (getConnection ());

    }

    Return __tx;

    };

    public connection getConnection() throws SQLException

    {

    If (__onn! = null) return __onn;

    ElseIf (__tx! = null) return __tx.getConnection ();

    ElseIf (__dataSource! = null) __onn = __dataSource.getConnection ();

    Return __onn;

    }

    I'm trying to generate the class in the model project and create DataControl to it and use the action method, but noting the change and I get null pointer again!

    JDeveloper Versino = 11.1.1.7.0

    I would like to ask you another question: why generate java packaging at all?

    Where you want to call the package?

    Back to your question: you should see the code as

    Public Sub setDataSourceLocation (String dataSourceLocation) throws SQLException {}

    javax.sql.DataSource dataSource;

    try {}

    Class cls = Class.forName ("javax.naming.InitialContext");

    Object ctx = cls.newInstance ();

    Meth java.lang.reflect.Method is CL. GetMethod ("search", new class [] {String.class});

    dataSource = (javax.sql.DataSource) meth.invoke (ctx, new Object() {"java: comp/env /" + dataSourceLocation});

    setDataSource (dataSource);

    } catch (Exception e) {}

    again throw java.sql.SQLException ("data source initialization error in" + dataSourceLocation + ":" + e.getMessage ());

    }

    }

    in the generated code. This code search a data source (that you have defined for example on the Weblogic Server) by calling the method

    setDataSourceLocaltion("jdbc/HRConnDS");

    That look to the top of the n data source stores in the class variable.

    Timo

  • connection between sql server and java

    someone please tell me how to connect to sql server with java

    Welcome to the forums.

    The forums are a research tool very useful - by using the search box you will see near the top right.  You will find that most of the questions that ask you, which, have already been asked on the forum, so it pays to research frist - that way you get a faster response and you can find other interesting things.

    In this case, I did a quick search using SQL Server and found these threads that will probably help:

    http://supportforums.BlackBerry.com/T5/Java-development/database-connectivity-SQL-Server-2008/m-p/60...

    http://supportforums.BlackBerry.com/T5/Java-development/SQL-Server-connection-in-BB/m-p/416391#M8239...

Maybe you are looking for