Help in JAVA stored procedure

Hi,
We need to interface a JAVA application from a pl/sql block. We are using JAVA stored procedure to do the same. This
stored java class ( that we call from a PL/SQL procedure) has the
statement ( " textFont = new Font("Arial", 0, 11)" ) where a Font is
initialized. This is throwing an error message as given below. Please
let us know if there is any issue with respect to usage of java.awt
classes in java stored procedures (Oracle JVM of Oracle9i Enterprise
Edition Release 9.2.0.2.0).
We tracked down the exception to the following stack trace:
java.lang.NullPointerException
at java.lang.Class.forName0(Class.java)
at java.lang.Class.forName(Class.java)
at
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnviron
ment.java)
at java.awt.Font.initializeFont(Font.java)
at java.awt.Font.<init>(Font.java)
at com.idautomation.pdf417.PDF417.<init>(com/idautomation/pdf417/PDF417)
at GenBarCode.createBarCode(GenBarCode.java:24)
at CallGenBarCode.callGenerateBarCode(CallGenBarCode.java:14)
g_error_text= ORA-29532: Java call terminated by uncaught Java
exception: java.lang.NullPointerException in CallGenBarCode_callGBC
DECLARE
ERROR at line 1:
ORA-20001: ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NullPointerException in CallGenBarCode_callGBC err 15
ORA-06512: at line 12
Any pointers in this regard will be of great help.
thanks,
Ayyappa

Hi,
OracleJVM, as a server-side VM, does not support any UI classes such as awt and swing. The basic GUI components found in the JDK's Abstract Windowing Toolkit (AWT) cannot be used in Stored procedures.
For more information refer to http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96659/01_intro.htm#16826
Hope this helps.
Sujatha.
http://otn.oracle.com/sample_code/content.html

Similar Messages

  • Parameter length limition passing to java stored procedure! help

    hi:
    i am working with java stored procedure to do some resource consuming work. i have to pass a long string (varch2) or bytes(log raw) which is larger than 32k which is the limitation
    set by oracle.
    is there a walk around?
    another question:
    i have to call java stored procedure from session beans ( weblogic app server) and how can i make sure the code
    in session beans and that in java stored procedures to be in
    the same transaction?
    regards
    daniel wang

    Hi Daniel,
    In answer to your first question: use a CLOB (for the long string)
    and a BLOB (for the long raw). Do a search for CLOB and BLOB at the
    Technet site:
    http://technet.oracle.com
    There are lots of resources including documentation and sample code.
    In answer to your second question: first, let me say that the J2EE
    forum is more suitable for that question (I haven't looked yet, but
    you may have posted there as well!). Anyway, you need to set an
    appropriate transaction attribute in your "ejb-jar.xml" descriptor
    file for your session bean. If you want to make sure that the
    session bean and java stored procedure participate in the same
    transaction, I suggest using "Required", as in:
    <trans-attribute>Required</trans-attribute>
    Hope this helps.
    Good Luck,
    Avi.

  • HELP!!! Problem of Calling external Web Service from a Java Stored Procedur

    1.I read the topic on http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html about Calling external Web Service from a Java Stored Procedur.
    2.After I import .jar to Oracle what is required by the topic,som error occued.
    Like: ORA-29521: javax/activation/ActivationDataFlavor class not found,
    ORA-29545: badly formed class.
    3.These is not enough .jar required on the topic? What can I do for ORA-29545: badly formed class?
    Thany you!

    Try this
    Re: HELP! Loading Java Classes into Oracle ERROR

  • Help with use of Java Stored Procedures to invoke Java Code within Applicat

    Good afternoon everyone
    Our development team is looking for some assistance/validation of a design strategy we are deploying for a client. Let me first layout the environment and then the design issue at hand:
    Business User Workstation component: Oracle SQL*Developer 1.5.x
    Reporting Tool: Actuate e.Spreadsheet A10
    Application Web UI: J2EE application developed with Eclipse
    Application Scripting: Application has a scripting component whereby business users can write Oracle PL/SQL to perform many of the functions that are available in the Web UI, but can be batched up or repeated several times.
    Application Server WebLogic 9.2.3 (client constraint)
    Database Serve: Oracle 11g, Release 11.1.0.7
    Lots of other stuff included but irrelevant for this conversation.
    Here's the scenario in question:
    1.     Through the scripting solution, the application user must use PL/SQL to invoke functionality within the Web UI. All PL/SQL that the application user creates does not contain any SQL. Instead our security model mandates that “pre-defined” routines will perform all of the SQL operations against the database; the application user simply invokes the stored procedures of functions to perform activities in the database.
    2.     There is a component of the scripting application that facilitates the creation of reports. In our application, we are using Actuate’s e.Spreadsheet Engine to create the report and format the report based on a template. The template is provided as input, as well as other data items, into Actuate for processing. The net result is the report is created by the Actuate e.Spreadsheet engine in pdf format and then sent back to the user for distribution to other users in the company.
    3.     The Actuate e.Spreadsheet engine consists of one or more JAR files within the Application Server framework. The Web UI utilizes these JAR files as well to perform report generation and data manipulation activities. In the case of the reporting functionality, the pdf report that is generated by Actuate is returned into either the Web UI or into the scripting component for persistence in the database. The mechanism exists to create multi-step jobs that can create multiple reports in one run.
    4.     So to facilitate the above, we are creating one or more Java Stored Procedures that will mediate the communication between the PL/SQL the user’s create and the Java components that are required for business processing. PL/SQL will invoke one or more Java Stored Procedures. Then the Java Stored Procedures invoke Actuate e.Spreadsheet, generate the report, saves the report in the database and returns control back to the invoking procedure.
    So the question is: Is this a viable and correct use of Oracle Java Stored Procedures. What are the advantages/disadvantages of doing so? Any security issues or potholes that you can think of? Tuning issues for the JVMs? Any white papers that you can think of?
    For any Oracle employees that respond, material such as Oracle Whitepapers, etc. would be great.
    I can be contacted at (313) 227-4350 or at [email protected]
    Thanks in advance.

    So are you planning on loading the entire e.Spreadsheet engine into the database server's JVM?
    If so, I would expect that to work, but I expect that you'd have some performance issues. I'd expect that the process of building these PDFs is going to be relatively expensive. Tuning the database server's JVM tends to be rather more challenging than tuning JVM's in an app server.
    If not, I'm not sure how the Java stored procedure would invoke the e.Spreadsheet engine on the application server. It is possible to use Oracle AQ to send a JMS message, but I don't think you can use the standard J2EE JMS APIs-- I think you'd have to use Oracle's AQ interface.
    Justin

  • Error while deploying a Java Stored Procedure using JDeveloper

    Hi,
    I was going thru the Oracle By Example article: "Developing SQL and PL/SQL with JDeveloper". (http://www.oracle.com/technology/obe/obe9051jdev/ide1012/plsqlobe/obeplsql.htm)
    One of the items in this article is - "Creating and Deploying a Java Stored Procedure"
    I was able to create a java class, compile it. Created a deployment profile. created a pl/sql wrapper. While trying to deploy the java stored procedure, I am getting the following error:
    Invoking loadjava on connection 'hr_conn' with arguments:
    -order -resolve -thin
    errors : class package1/mypackage/JavaStoredProc
    ORA-29521: referenced name java/lang/StringBuilder could not be found
    The following operations failed
    class package1/mypackage/JavaStoredProc: resolution
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:474)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:361)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:285)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:383)
    #### Deployment incomplete. #### Oct 27, 2005 1:38:56 PM
    Appreciate your help on this..

    I am using Jdeveloper 10.1.3 Early Access Version. JDK comes with it. I also have another JDK on my machine (JDK1.4.2_09)

  • Error while executing java stored procedure from a pl/sql procedure

    We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
    The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NoClassDefFoundError
    Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
    Any pointers would be of great help!
    Thanks in advance

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Unable to access Custom UDTs returned from a Java Stored Procedure

    Hi,
    I have a UDT in the DB :-
    create type contactrecord as object (
    CN_ID NUMBER(8),
    CN_TITLE VARCHAR2(40),
    CN_FIRST_NAME VARCHAR2(25)
    and this is the corresponding java class ContactDetails.java that maps to this UDT, that I loaded in the Aurora VM.
    package package1;
    mport java.sql.SQLData;
    import java.sql.SQLException;
    import java.sql.SQLInput;
    import java.sql.SQLOutput;
    public class ContactDetails implements SQLData
    private String sql_type;
    private long CN_ID;
    private String CN_TITLE;
    private String CN_FIRST_NAME;
    public String getSQLTypeName() throws SQLException
    return this.sql_type;
    //implementation of readSql
    public void readSQL(SQLInput stream, String typeName) throws SQLException
    sql_type = typeName;
    CN_ID = stream.readLong();
    CN_TITLE = stream.readString();
    CN_FIRST_NAME = stream.readString();
    public void writeSQL(SQLOutput stream) throws SQLException
    stream.writeLong(CN_ID);
    stream.writeString(CN_TITLE);
    stream.writeString(CN_FIRST_NAME);
    //getters and setters for the class vars go here.....
    There is another class A.java that has a java stored procedure/function, which I loaded into the Aurora VM
    Here is the class.
    package package1;
    public class A
    public static ContactDetails returnObject(String name )
         ContactDetails cd = new ContactDetails();
         cd.setCN_ID(1);
    cd.setCN_FIRST_NAME(name);
    return cd;
    Then I declared the call spec for A.returnObject() as
    FUNCTION returnObject(name varchar2) return contactrecord
    AS LANGUAGE JAVA
    NAME 'package1.A.returnObject(java.lang.String) return package1.ContactDetails';
    Then I tried to call the function returnObject through JDBC calls from a class in another VM.
    When I access the object returned by the function, I get a null object.
    Here is the Client code:
    CallableStatement cs = null;
    ResultSet rs = null;
    try
    cs = conn.prepareCall("{ ? = call returnObject(?) }");
    java.util.Map map = conn.getTypeMap();
    map.put("ADMIN.CONTACTRECORD", Class.forName("package1.ContactDetails"));
    conn.setTypeMap(map);
    cs.registerOutParameter(1, OracleTypes.STRUCT, "ADMIN.CONTACTRECORD");
    cs.setString(2, "John Doe" );
    cs.execute();
    ContactDetails cd = (ContactDetails)cs.getObject(1);
    System.out.println("contact first name is:-"+cd.getCN_FIRST_NAME()); //Null Pointer here..cd is null....:(
    if (cs != null) cs.close();
    catch(Exception e)
    e.printStackTrace();
    Although If I try to access the same function from a pl/sql block, I am able
    to access the contactrecord fields.
    What could be wrong ..???
    I could not find any error with the object mapping, as it works perfectly when I interact directly from my VM to the DB,
    without going thru the aurora VM.
    I am using a OCI driver to connect to the DB via JDBC.
    Thanx in advance for any help at all.
    -sk

    Shahid,
    I too have had bad luck in many cases with the automatic translation of Java types to PL/SQL and back. I think the SYS package on the PL/SQL side which handles some of the conversion is DBMS_PICKLER (there are equivalent Java classes which do the same in that world and seem to execute automagically when a conversion is needed). You might want to double-check the data type mappings against the DOC on OTN to make sure they map 1-1. Also make sure the permissions are granted against your objects to whoever is executing them, etc. Very often, I've resorted to passing simple scalar types between the two languages as in some cases the results with complex types are inconsistent.
    Sorry this isn't much help,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • ORA-04030: out of process memory when using Java Stored Procedures

    Hello,
    I have a problem using Java Stored Procedures in Oracle 10g.
    My Java application performs http posts to a webservice and the response is parsed in order to populate some DB tables.
    There is a scheduled job which calls the Java Stored Procedure every x minutes.
    No matter of the 'x minutes' values - after about 160 - 200 calls I get this error:
    ORA-04030: out of process memory when trying to allocate 1048620 bytes (joxp heap,f:OldSpace)
    ORA-04030: out of process memory when trying to allocate 2097196 bytes (joxp heap,f:OldSpace)
    The job stops just while is posting the http request. The weird thing is that almost each time the first http post request I get this error:
    java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
         at java.net.Socket.connect(Socket.java:426)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
         at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
         at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    and the second try works fine.
    So, The out of process memory occured each time just before getting such an error, and I suspect to be a connection between these errors.
    Tech details:
    1. OS: WinXP
    2. Oracle 10.1.0.2.0
    3. To perform http post I use HttpClient 3.1 from Apache.
    4. I checked the http connection to be closed each time, and this is done.
    5. I checked the oracle statement and connection to be closed each time and this is done
    6. The JVM error (logged in .trc files of Oracle) is:
    java.lang.OutOfMemoryError
         at java.lang.Thread.start(Native Method)
         at sun.security.provider.SeedGenerator$ThreadedSeedGenerator.run(SeedGenerator.java:297)
    DB Settings details:
    Starting up ORACLE RDBMS Version: 10.1.0.2.0.
    System parameters with non-default values:
    processes = 200
    sessions = 225
    shared_pool_size = 159383552
    large_pool_size = 8388608
    java_pool_size = 104857600
    nls_language = AMERICAN
    control_files = C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL03.CTL
    db_block_size = 8192
    db_cache_size = 29360128
    compatible = 10.1.0
    fal_client = XXXXXX
    fal_server = XXXXXXs
    log_buffer = 524288
    log_checkpoint_interval = 100000
    db_files = 70
    db_file_multiblock_read_count= 32
    db_recovery_file_dest = C:\oracle\product\10.1.0\flash_recovery_area
    db_recovery_file_dest_size= 2147483648
    standby_file_management = AUTO
    undo_management = AUTO
    undo_tablespace = undotbs_01
    undo_retention = 14400
    remote_login_passwordfile= EXCLUSIVE
    db_domain =
    dispatchers = (PROTOCOL=TCP) (SERVICE=XXXXXXXDB)
    remote_dependencies_mode = SIGNATURE
    job_queue_processes = 4
    parallel_max_servers = 5
    background_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\BDUMP
    user_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\UDUMP
    max_dump_file_size = 10240
    core_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\CDUMP
    sort_area_size = 1048576
    sort_area_retained_size = 1048576
    db_name = XXXXXX
    open_cursors = 500
    optimizer_mode = FIRST_ROWS
    pga_aggregate_target = 25165824
    Any help would be appreciated. Thanks.
    Can be a problem with JVM threading under Oracle ?

    The server prcess failed to allocate more memory for large objects ( in Oldspace).
    If you Google ORA-04030, you will see several recommendations to work around this.
    The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
    Kuassi http://db360.blogspot.com

  • Calling the Java Method in PL/SQL Java Stored procedure errors out

    Hi,
    I could not find a suitable thread to post my PL/SQL question so iam posting it here.........
    I have written a java class by name XYZ which has a method ABC for which there are 9 arguements being passed and its a VOID method.
    This java class has been loaded into ORACLE using DBMS_JAVA.LOADJAVA pkg, Now this class is being called in the oracle as a JAVA Stored procedure...... When ever im trying to call the procedure it throws the following error
    ORA-29531: no method
    *Cause:    An attempt was made to execute a non-existent method in a
    Java class.
    *Action:   Adjust the call or create the specified method.
    The code snippet as follows
    JAVA CODE:
    Class xyz
    public static void Abc (String hostName,
    int port,
    String serviceURL,
    String soapAction,
    int timeOut,
    String wsUser,
    String wsPasWd,
    String keyStore,
    String keyStorePasWd)
    //method implementation
    JAVA STORED PROCEDURE:
    create OR REPLACE procedure ABC_JAVA_SP_CALL
    (p_hostname in varchar2, p_port in number, p_serviceurl in varchar2, p_soapaction in varchar2, p_timeout in number, p_wsuser in varchar2, p_wspasswd in varchar2, p_ks_path in varchar2, p_ks_passwd in varchar2)
    as
    language java
    name 'xyz.Abc(java.lang.String, int, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String)';
    When i try to call
    declare
    p_hostname varchar2(100);
    p_port number;
    p_serviceurl varchar2(100);
    p_soapaction varchar2(100);
    p_timeout number;
    p_wsuser varchar2(100);
    p_wspasswd varchar2(100);
    p_ks_path varchar2(100);
    p_ks_passwd varchar2(100);
    begin
    //SP which returns the values for the required parameters.
    comppkg.getvcsinfo(
    p_hostname,
    p_port ,
    p_serviceurl,
    p_soapaction,
    p_timeout,
    p_wsuser,
    p_wspasswd,
    p_ks_path,
    p_ks_passwd
    Layer7_icengc_ws_tes(p_hostname,
    p_port ,
    p_serviceurl,
    p_soapaction,
    p_timeout,
    p_wsuser,
    p_wspasswd,
    p_ks_path,
    p_ks_passwd);
    end;
    This thing ends up with
    29531. 00000 - "no method %s in class %s"
    *Cause:    An attempt was made to execute a non-existent method in a
    Java class.
    *Action:   Adjust the call or create the specified method.
    Im not understanding what wrong am i doing
    pls help
    Edited by: madhusudan on Feb 12, 2013 8:07 PM

    Hello,
    there is the forum {forum:id=65} for questions about using Java within Oracle.
    Regards
    Marcus
    Edited by: Marwim on 13.02.2013 07:56
    I could not find a suitable thread to post my PL/SQL question so iam posting it here.........You got the hint to the correct forum alread in another thread {message:id=10837976}
    And if you think this is not related to Java but PL/SQL, then you should ask in {forum:id=75}

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '&lt;&lt;ALL FILES&gt;&gt;', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • [b]Java Stored Procedure generating ora-932 in Oracle 9i [/b]

    Hi ,
    I have written a Java Stored procedure. And I have written a wrapper function as bellow
    FUNCTION "GENERATE_AC_EXCEL_REPORT_FN"
    ( refCursorCall VARCHAR2, fromDate Date, ToDate Date,
    nsn VARCHAR2, period varchar2, site VARCHAR2,
    vendor VARCHAR2, spotbuyType VARCHAR2, dataType, VARCHAR2 )
    return number
    as LANGUAGE java
    NAME 'accountingExcelReports.excelPrinter( java.lang.String, java.sql.Date, java.sql.Date, java.lang.String,java.lang.String , java.lang.String,
    java.lang.String, java.lang.String , java.lang.String) return int';
    This function returns 1000 upon successful execution.
    This used to execute fine in Oracle 8.1.7.
    We installed Oracle 9i recently.
    Server version is 9.2.0.2.1.
    Jserver version is 9.2.0.2.0 .
    Now The function call works fine for the first time. And When execute it for sencond time in the same Session,
    The program is erring out saying inconsistent data typpes.
    This is happening during passing parameters.
    SQL&gt; select
    2 generate_ac_EXCEL_report_fn('Period', to_date('7-1-2002','MM-DD-YYYY'),
    3 to_date('7-31-2002','MM-DD-YYYY'), NULL,
    4 NULL, NULL, NULL, 'ALL' ,'SPOTBUY') from dual;
    GENERATE_AC_EXCEL_REPORT_FN('PERIOD',TO_DATE('7-1-2002','MM-DD-YYYY'),TO_DATE('7-31-2002','MM-DD-YYY
    1000
    SQL&gt; select
    2 generate_ac_EXCEL_report_fn('Period', to_date('7-1-2002','MM-DD-YYYY'),
    3 to_date('7-31-2002','MM-DD-YYYY'), NULL,
    4 NULL, NULL, NULL, 'ALL' ,'SPOTBUY') from dual;
    select
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected IN Conversion failed
    And upon further testing, i noticed this happens when the dates are passed. If date parameters are nulled out, Then the program executes perfectly any number of times.
    The same program worked fine in Oracle 8.1.6
    Any ideas?
    Please help.
    Thanks,
    Srinivas

    Hi Srinivas,
    you shouldn't be calling conn.close() and its not needed when using Server Side Internal driver. If you are calling conn.close, then .....
    extract from JDBC user guide
    If you do call the close() method, be aware of the following:
    All connection instances obtained through the defaultConnection() method, which actually all reference the same connection object, will be closed and
    unavailable for further use, with state and resource cleanup as appropriate. Executing defaultConnection() afterward would result in a new connection
    object.
    Even though the connection object is closed, the implicit connection to the database will not be closed.
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/advanc.htm#1001042
    Elango.

  • URGENT: Java stored procedure on oracle 92 database is not working

    Hi,
    I am having an issue regarding java stored procedures. I have created a java class that uses the bouncycastleprovider ( bcprov-jdk13-141.jar ) to encrypt strings. I tested against the version of the java virtual machine that comes bundled with oracle and it works perfectly. I then used JDeveloper to load the class on the database with the resolve, noverify and order flags checked and it shows no errors but when I try to execute the stored procedure it throws the following exception:
    java.lang.ExceptionInInitializerError:
    java.lang.SecurityException: Cannot set up certs for trusted CAs: java.net.MalformedURLException: no protocol: US_export_policy.jar
    at javax.crypto.SunJCE_b.<clinit>(DashoA6275)
    at javax.crypto.Cipher.a(DashoA6275)
    at javax.crypto.Cipher.getInstance(DashoA6275)
    at RijndaelEnhanced.encrypt(RijndaelEnhanced.java:57)
    at RijndaelEnhanced.encrypt(RijndaelEnhanced.java:73)
    I loaded jce1_2_2.jar, sunjce_provider.jar, bcprov-jdk13-141.jar. Also replaced the US_export_policy.jar, local_policy.jar with the unrestrictive version. I add the security provider dinamically with a call to Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 2);
    I also did a select on the user_objects table and all the classes are in VALID status.
    When I run my application using the java virtual machine that is located under C:\Oracle\oracli9i\jdk\jre\bin directory it works fine but when I try to execute on the database it won't work. I found a bug that was if the jce1_2_1.jar file existed in the C:\Oracle\oracli9i\jdk\jre\lib\ext directory ( even if it's extension is renamed ) it won't work because the certification file had expired but I don't know if this has anything to do with this error.
    Am I missing something?
    Please I need an urgent solution to this problem.
    Thanks in advance.
    Bruno Oliveira

    SomeoneElse wrote:
    Waaaaahhhhhhh!I was just thinking the same thing.... ya beat me to it...
    To the OP:
    As an up and coming DB Developer who now works for a small tech firm straight outta college, I can tell you for sure that you will definitely not get anywhere in your impatient life... look behind your back you miserable dude, your job might be in danger since ya got a bad attitude AND you can't figure out an error you are getting from a Java SP. So instead of helping you, I am going to simply tell you how you SHOULD act in a community of practice.
    1. Be nice when looking for help
    2. BE NICE WHEN LOOKING FOR HELP!!!
    Pretty simple right?
    Know what else is really simple? Looking at the topics of each board to make sure ya post in the right board! You people disgust me; somehow getting by in your professional career acting the way you do. I sure hope your "online" persona isn't a reflection of your real attitude towards people, almost pathetic and extremely immature.
    Sorry bout the rant, it is Friday, I know :) Didn't get my coffee this morning. Have a good one all!
    -Tim

  • NameFromLastDDL Error during java stored procedure upload...

    Hi guys,
    I am trying to upload a class to send email within a java stored procedure.
    JDeveloper fails to upload the class, and the error message doesn't help me:
    I guess the automatically generated SQL statment features a "NameFromLastDDL" argument, but i have no control over that....anybody had this issue before ?
    Following, the "ugly" exception:
    Error while creating class client/Utils
    ORA-06550: line 1, column 91:
    PLS-00201: identifier 'NameFromLastDDL' must be declared
    ORA-06550: line 1, column 85:
    PL/SQL: Statement ignored
    java.sql.SQLException: ORA-06550: line 1, column 91:
    PLS-00201: identifier 'NameFromLastDDL' must be declared
    ORA-06550: line 1, column 85:
    PL/SQL: Statement ignored
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:184)
         at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3076)
         at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4273)
         at oracle.aurora.server.tools.loadjava.ClientClassObject.create(ClientClassObject.java:68)
         at oracle.aurora.server.tools.loadjava.SchemaObject.process1(SchemaObject.java:223)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:530)
         at oracle.aurora.server.tools.loadjava.LoadJava.addClass(LoadJava.java:584)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:434)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
         at oracle.aurora.server.tools.loadjava.LoadJava.addJar(LoadJava.java:717)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:430)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:347)
         at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:643)
         at oracle.aurora.server.tools.loadjava.LoadJava.processDeferredFiles(LoadJava.java:615)
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:806)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)
    The following operations failed
    class client/Utils: creation (createFailed)
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)

    I think u dont've previleges to run
    the procedure.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
    hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
    CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
    cstmt.setString(1,"[email protected]");
    cstmt.setString(2,"Mail from Stored Proc");
    cstmt.setString(3,"This is test mail from Oracle8i");
    cstmt.execute();
    i am getting following Exception:
    java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
    ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
    ORA-06512: at line 1
    <HR></BLOCKQUOTE>
    null

  • Deploying SQLJ classes as Java Stored Procedures using JDeveloper 10g

    Hello,
    I have defined a SQLJ class, MwaSqljDao.sqlj, in JDeveloper. When I right click on the SQLJ class and "make" the class. It appears to succeed.
    However when I attempt to build the project in which the SQLJ class is a member of, a class that uses the SQLJ class has the following compile error:
    - MwaSqljDao not found.
    After a little digging it appears JDeveloper is able to compile the .sqlj file to a .java file in the classes output directory. However it does not take it to the next step of compiling the .java file into a .class file.
    Is SQLJ still a main stream Oracle technology? Or has it been cast to way side to make way for other technology?
    If SQLJ is still a supported Oracle technology how do go about compiling the SQLJ class using JDeveloper?
    My goal is to deploy SQLJ into JServer as a Java Stored Procedure class.
    Thank you,
    Rob

    Excellent.
    Especially that you resolved it and even more so that you posted the solution.
    I do wonder whether you would have gotten help (faster) has you asked in a JDeveloper-related forum such as " Forum Home » Developer Tools » JDeveloper and ADF" at JDeveloper and ADF

  • Using XMLType in a Java Stored Procedure

    I have the following piece of java test code that attempts to read an XMLType object from the database. When I run this client side, using either the oci or thin driver it works fine. When I run the same code as a java stored procedure I get the exception shown below.
    (The problem was first seen on 9.2.0.3/Win2K. Ive patched to 9.2.0.4 and am still getting the same error)
    Can anybody please help?
    Thanks
    Java Test Code:
    ===============
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.*;
    public class Test {
    public static void main(String[] args) throws Exception {
    System.out.println(run());
    public static String run() throws Exception {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // client side THICK
    //Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=ORACLE)))", "scott", "tiger");
    // client side THIN
    //Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORACLE", "scott", "tiger");
    // server side
    Connection conn = DriverManager.getConnection("jdbc:default:connection");
    OracleCallableStatement stmt = (OracleCallableStatement)conn.prepareCall("{? = call XDBUriType('/test.xml').getXML()}");
    stmt.registerOutParameter (1, OracleTypes.OPAQUE,"SYS.XMLTYPE");
    stmt.execute();
    XMLType xml = XMLType.createXML(stmt.getOPAQUE(1));
    return xml.getStringVal();
    SQLPLUS TRACE:
    ==============
    SQL> VARIABLE res VARCHAR2(4000);
    SQL> call run() into :res;
    call run() into :res
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.Exception: Unimplemented Feature
    Dump File:
    ==========
    Dump file c:\oracle9i\admin\oracle\udump\oracle_ora_4964.trc
    Fri Oct 24 12:04:30 2003
    ORACLE V9.2.0.3.0 - Production vsnsta=0
    vsnsql=12 vsnxtr=3
    Windows 2000 Version 5.0 Service Pack 4, CPU type 586
    Personal Oracle9i Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    Windows 2000 Version 5.0 Service Pack 4, CPU type 586
    Instance name: oracle
    Redo thread mounted by this instance: 1
    Oracle process number: 12
    Windows thread id: 4964, image: ORACLE.EXE
    *** 2003-10-24 12:04:30.000
    *** SESSION ID:(10.121) 2003-10-24 12:04:30.000
    java.lang.Exception: Unimplemented Feature
    at oracle.xdb.spi.XDBContext.getServerEnv(XDBContext.java)
    at oracle.xdb.XMLType.initConn(XMLType.java:1874)
    at oracle.xdb.XMLType.<init>(XMLType.java:846)
    at oracle.xdb.XMLType.createXML(XMLType.java:469)
    at cms.Test.run(Test.java:27)

    I have the very same problem. Somebody from Oracle Corp please reply. If this is a bug, please do not let us waste time to research a solution. Otherwise, point a way out!
    Thanks,

Maybe you are looking for