Java external procedure .....

Hi, i am calling my java function from oracle but i am getting this error :
'ora-29541 : class Eadmin.com/XX/MyClass could not be resolver'
where com.XX is package name for MyClass.
My java class code:
package com.XX;
public class MyClass {
public MyClass(){}
public static String EString(String strText, String strKey) {
/**CODE**/
return **SOME STRING**;
I did following steps to load JAVA function:
1) create or replace directory bfile_dir as 'e:\oracle9i\bin\com\XX'; /*my class files are in folder 'com\XX' */
2)create or replace function plsEString(varchar2,varchar2)
return varchar2 as language JAVA NAME 'com.XX.MyClass.EString(java.lang.String,java.lang.String) return java.lang.String';
3) declare
str varchar2(200);
begin
str:=plsEString('maviner','hi');
dbms_output.put_line('str: ' || str);
end;
ERRORS
ERROR at line 1:
ORA-29541: class EADMIN.com/XX/MyClass could not be resolved
ORA-06512: at "EADMIN.PLSESTRING", line 0
ORA-06512: at line 4
Where i am doing wrong?
thanx

I am using CREATE OR REPLACE JAVA CLASS,i missed that step in my first mail.
Is it possible that jdk version in oracle 9i is giving me poblem . Becoz for my java class i am using j2sdk1.4.2
I tried to deploy my class using Jdeveloper and i get this following error :
"ORA-29521: referenced name javax/crypto/NoSuchPaddingException could not be found"
I am importing javax.crypto in my class.
How i can update oracle java file to latest version?

Similar Messages

  • Java external procedure parameters

    Hi, I'm calling a Java External Procedure like this:
    CREATE FUNCTION HAS_GROUP (STRGROUP IN VARCHAR2)
    RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'PKGPORTAL.GROUPS.HAS_GROUP
    (java.lang.String) return java.lang.String';
    The thing is that I need also to send it the CLIENT_IDENTIFIER, but I saw in every example that the parameters that the PLSQL function recieves are the same that you send to Java. Am I able to send an extra parameter to Java?. I need it to recieve the CLIENT_IDENTIFIER. Thank you.

    I am using CREATE OR REPLACE JAVA CLASS,i missed that step in my first mail.
    Is it possible that jdk version in oracle 9i is giving me poblem . Becoz for my java class i am using j2sdk1.4.2
    I tried to deploy my class using Jdeveloper and i get this following error :
    "ORA-29521: referenced name javax/crypto/NoSuchPaddingException could not be found"
    I am importing javax.crypto in my class.
    How i can update oracle java file to latest version?

  • Java stored procedure vs. PL-SQL vs. external java program

    Hi,
    I'm using a stored procedure for running a query and a few consequent updates. Currently I'm using Java stored procedure for that, which was my choice for simplicity on one hand, and running with the DB on the other.
    In my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.
    Any experiences? recommendations?
    Thanks,
    Dawg

    In my tests, strangely enough it came out that running as java stored procedure was 3-4 times slower than running as a java program outside the database. I don't know how to explain this, and I wonder if switching to PL/SQL will improve the performance of the code.This isn't strange at all. See: Oracle's JVM (Aurora) is an independent Java Virtual Machine implementation, in accordance to specification. It implements all necessary parts of it (I think so). When you use an external JVM (I assume it's Sun's HotSpot JVM) you use completely different product. It is implemented in different way, it has many different code parts.
    One of the biggest differences between Oracle's JVM and Sun's JVM is [Just-in-Time compiler|http://en.wikipedia.org/wiki/Just-in-time_compilation]. Oracle has implemented it only in the 11g version of database, i.e. 2 years ago, while Sun performed it back in 2000 and continues to improve it for the last 9 years. That would explain obvious differences between Java program inside and outside the DB: they are executed in absolutely different worlds. Diffs could be up to 10x times or more - that's not unusual.
    If you are on 10g and want to compare performance of stored Java procedure vs external program, then you might use additional command-line instruction for external program to disable JIT:
    -XintPS. I wouldn't use Java for your task - that's a total overkill. Use simple SP instead.

  • How to open external files in a Java stored procedure?

    Hi y'all,
    I'm trying to open an external text file from a Java stored procedure. The java sp has been successfully loaded, resolved, published, etc. in Oracle. I'm using the following statement to try to open the file (enclosed in a try/catch block):
    BufferedReader fileObj = new BufferedReader(new FileReader("fileName.txt"));
    I'm getting a file not found error. Where is Oracle looking (i.e., what directory)?
    Your help is greatly appreciated,
    Gary

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Gary Nool ([email protected]):
    Hi y'all,
    I'm trying to open an external text file from a Java stored procedure. The java sp has been successfully loaded, resolved, published, etc. in Oracle. I'm using the following statement to try to open the file (enclosed in a try/catch block):
    BufferedReader fileObj = new BufferedReader(new FileReader("fileName.txt"));
    I'm getting a file not found error. Where is Oracle looking (i.e., what directory)?
    Your help is greatly appreciated,
    Gary<HR></BLOCKQUOTE>
    Hi Gary,
    you must use a "database directory", e.g:
    SQL>create directory WORKING_DIR as '/home2/common/';
    SQL> select * from all_directories;
    OWNER DIRECTORY_NAME
    DIRECTORY_PATH
    SYS WORKING_DIR
    /home2/common/
    Gert

  • Calling external servlet from java stored procedure

    Hello,
    I need to call an external servlet which is in 9iAS server ( unix box) from Java Stored procedure in oracle database.
    Can anybody give me an idea? is it possible?
    Thanks,
    Viswa

    I am trying the same. Here is URL which will help u.
    http://otn.oracle.com/sample_code/tech/java/jsp/samples/wsclient/Readme.html
    Let me know when you run servlet successfully.
    Regards
    Satish

  • 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

  • Problems calling external Web Service from a Java Stored Procedure

    I'm using a sample code that I found here about calling external web services from a Java Store Procedure ( Credit Agency Web Service http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html ) but when I run it ,send this error. I dont know what can I do or what is missing. Please help me. Thanks.
    Error: Premature EOF encountered [java.io.EOFException] [SOAPException: faultCode=SOAP-ENV:IOException; msg=Premature EOF encountered; targetException=java.io.EOFException: Premature EOF encountered] at org.apache.soap.SOAPException.(SOAPException.java:77) at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:765) at org.apache.soap.rpc.Call.invoke(Call.java:261) at oracle.otnsamples.wsclient.CreditAgencyServiceStub.authorizeCustomer(CreditAgencyServiceStub.java:84) at Products.jspService(Products.jsp:120) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:795) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:794) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)

    I'm also facing problem in running the example on the page http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html
    I've Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 and Oracle Application Server 10g (10.1.3). When I executed the following command,
    loadjava -thin -user sys/password@localhost:1521:oradb -resolve -synonym -verbose -grant public %OC4J_HOME%/webservices/lib/soap.jar %OC4J_HOME%/lib/dms.jar %OC4J_HOME%/jlib/javax-ssl-1_1.jar %ORACLE_HOME%/lib/servlet.jar %OC4J_HOME%/j2ee/home/lib/mail.jar
    ... mentioned in step 3 under the "Configuring the Application" section on the above link, the process terminates with the following error
    The following operations failed
    class oracle/net/www/protocol/https/Handler: resolution
    class oracle/net/www/protocol/https/HttpsURLConnection: resolution
    class oracle/soap/client/ProviderManagerClient: resolution
    class oracle/soap/client/ServiceManagerClient: resolution
    class oracle/soap/providers/JavaProvider: resolution
    class oracle/soap/providers/ejbprov/EntityEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatefulEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatelessEJBProvider: resolution
    class oracle/soap/providers/sp/SpProvider: resolution
    class oracle/soap/server/http/SOAPServlet: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection$1: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection: resolution
    class org/apache/soap/messaging/Message: resolution
    class org/apache/soap/rpc/Call: resolution
    class org/apache/soap/rpc/RPCMessage: resolution
    class org/apache/soap/rpc/Response: resolution
    class javax/net/DefaultServerSocketFactory: creation (createFailed)
    class javax/net/DefaultSocketFactory: creation (createFailed)
    class javax/net/ServerSocketFactory: creation (createFailed)
    class javax/net/SocketFactory: creation (createFailed)
    class javax/net/ssl/DefaultSSLServerSocketFactory: creation (createFailed)
    class javax/net/ssl/DefaultSSLSocketFactory: creation (createFailed)
    class javax/net/ssl/HandshakeCompletedEvent: creation (createFailed)
    class javax/net/ssl/HandshakeCompletedListener: creation (createFailed)
    class javax/net/ssl/SSLException: creation (createFailed)
    class javax/net/ssl/SSLHandshakeException: creation (createFailed)
    class javax/net/ssl/SSLKeyException: creation (createFailed)
    class javax/net/ssl/SSLPeerUnverifiedException: creation (createFailed)
    class javax/net/ssl/SSLProtocolException: creation (createFailed)
    class javax/net/ssl/SSLServerSocket: creation (createFailed)
    class javax/net/ssl/SSLServerSocketFactory: creation (createFailed)
    class javax/net/ssl/SSLSession: creation (createFailed)
    class javax/net/ssl/SSLSessionBindingEvent: creation (createFailed)
    class javax/net/ssl/SSLSessionBindingListener: creation (createFailed)
    class javax/net/ssl/SSLSessionContext: creation (createFailed)
    class javax/net/ssl/SSLSocket: creation (createFailed)
    class javax/net/ssl/SSLSocketFactory: creation (createFailed)
    class javax/security/cert/Certificate: creation (createFailed)
    class javax/security/cert/CertificateEncodingException: creation (createFailed)
    class javax/security/cert/CertificateException: creation (createFailed)
    class javax/security/cert/CertificateExpiredException: creation (createFailed)
    class javax/security/cert/CertificateNotYetValidException: creation (createFailed)
    class javax/security/cert/CertificateParsingException: creation (createFailed)
    class javax/security/cert/X509Certificate: creation (createFailed)
    exiting : Failures occurred during processing
    I've checked the path to all the jar files.
    I tried to run the command again with system/password instead sys/password but then I got the following stacktrace:
    The following operations failed
    class oracle/net/www/protocol/https/Handler: resolution
    class oracle/net/www/protocol/https/HttpsURLConnection: resolution
    class oracle/soap/client/ProviderManagerClient: resolution
    class oracle/soap/client/ServiceManagerClient: resolution
    class oracle/soap/providers/JavaProvider: resolution
    class oracle/soap/providers/ejbprov/EntityEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatefulEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatelessEJBProvider: resolution
    class oracle/soap/providers/sp/SpProvider: resolution
    class oracle/soap/server/http/SOAPServlet: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection$1: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection: resolution
    class org/apache/soap/messaging/Message: resolution
    class org/apache/soap/rpc/Call: resolution
    class org/apache/soap/rpc/RPCMessage: resolution
    class org/apache/soap/rpc/Response: resolution
    exiting : Failures occurred during processing
    Thanks in advance for any useful help.
    -

  • JAVA vs. External Procedures

    We are exporting blobs to files and have two methods to use. One is external procedures (see note:70110.1) and the other is a Java procedure (see Note:247546.1). Does anyone know which method is better from a performance standpoint.
    Thanks.

    hello,
    actually i can manage ETA without a varray, since there will b a maxximum of 3 -4 values of expected arrival times at each stop. this can b done with separate columns.
    though i dont quite understand how lag() will help me...from what i understand lag() is to access values of previous rows. but in ETA table each element in the varray(if there is one) is going to be the expected arrival time of buses on a particular route at that particular stop, and is different from the arrival time at a previous stop(i.e.row).
    but for my other table BUS_ROUTE i have 2 varrays describing the links and stops enroute. in quite a few procedures i have to loop through these arrays and perform some calculations in every iteration is varray the best way 2 go, or nested tables?
    Thank you
    Amina
    As an aside, external procedures tend by their very
    nature to be slow - there's an overhead incurred
    each time we step outside the database. Therefore
    you really ought to avoid using a C extproc unless
    your calculations really cannot be done in PL/SQL or
    a Java Stored Procedure.
    Also, before you go down the VARRAY route you should
    consider the virues of analytic functions, notably
    [url=http://download-west.oracle.com/docs/cd/B1050
    1_01/server.920/a96540/functions56a.htm#83619]LAG()[/u
    rl]. I think you really ought to do some
    benchmarking of parformance before you start afdding
    denormalised columns like ETA. You may find the
    overhead in maintaining those columns exceeds their
    perceived benefits.
    Cheers, APC

  • 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.

  • Database design and pl/sql vs external procedures

    hi,
    My project involves predicting arrival time of a bus at a bus-stop, given statistical data of traffic patterns on the previous ‘n’(say 3) days, as well as the current location of the bus(latitude-longitude).
    Given current bus location, I derive my distance-until-destination bus-stop, which must be translated into time until arrival.
    Ive enlisted the triggers and procedures involved in making the prediction. Thse procedures especially the determination of perpendicular distances involve some complex trigonometric operations. I would like to know if my approach is correct and my database design is suited for the operations to b performed.
    Will it be more efficient to implement the procedures as external procedures or as pl/sql blocks
    This is my database design:
    LINKS ( a link is the road segment between adjacent bus-stops)
    LINK_ID                NUMBER      [PRIMARY-KEY]
    START_LATITUDE          NUMBER     
    START_LONGITUDE     NUMBER     
    START_STOP_ID          NUMBER
    END_LATITUDE          NUMBER
    END_LONGITUDE          NUMBER
    END_STOP_ID          NUMBER
    LINK_LENGTH          NUMBER
    BUS_ROUTE
    ROUTE_ID               NUMBER
    LINKS_ENROUTE          VARRAY(30) OF NUMBER
    STOPS_ENROOUTE          VARRAY(30) OF NUMBER
    TRACK(keeps track of current location of bus)
    BUS_ID           NUMBER          [PRIMARY-KEY]
    ROUTE          VARCHAR2(20)
    LATITUDE          NUMBER
    LONGITUDE          NUMBER
    TS               TIMESTAMP
    LINK_ID          NUMBER
    START_STOP     NUMBER
    END_STOP          NUMBER
    ARRIVAL_TIMES(actual arrival times of the bus, updated by track)
    BUS_ID           NUMBER     [PRIMARY-KEY]
    BUS_ROUTE          VARCHAR2(20)
    ARRIVAL          TIMESTAMP
    STOP_ID          NUMBER
    ETA (expected time of arrival)
    BUS_ID          NUMBER
    BUS_ROUTE          VARCHAR2(20)
    BUS_STOP_ID     NUMBER
    ARR_TIME          VARRAY(5) OF TIMESTAMP
    Triggers and procedures
    1)TRACK_TRIGGER
    On insert/update of track determine which link the us is currently on.
    Invoke a procedure that calculates perpendicular distance from current location to all links en-route (cursor on LINKS).
    Results are stored in a temporary table. Select the link-id of the tuple whose perpendicular distance is MINIMUM. This is the link the bus is currently on. Place link-id, start_stop_id and end_stop_id in corresponding row of TRACK.
    2)ARRIVAL_TRIGGER
    update ARRIVAL_TIMES.and store in ARRIVAL_TIMES that start-stop id with the time-stamp of the current track record.
    b)update ETA: Find the BUS-STOPS that come before the START_STOP of current track record. All these rows are deleted from the ETA tables, as the bus has already crossed these stops.
    3)Prediction Algorithm Procedure.
    Determine distance until destination for each STOP, 20 stops down from stop current location.
    Determine current avg. speed of the bus over a 2 hour window, by dividing total distance traveled by time taken.
    Calculate time-until arrival T1=current avg. speed * distance until destination
    From the records of previous ‘n’ days (say n=3) find those buses on the same route that were near the link the bus is currently on. Again determine avg speed over 2 hour window and calculate avg. speed.
    Calculate travel time T(i) = speed*distance until destination.     i.=2,3, 4…
    The final predicted arrival time is a weighted sum of all T(i).
    I hope Im not asking for too much, but the help would be greatly appreciated.
    Thankyou,
    Amina

    hello,
    actually i can manage ETA without a varray, since there will b a maxximum of 3 -4 values of expected arrival times at each stop. this can b done with separate columns.
    though i dont quite understand how lag() will help me...from what i understand lag() is to access values of previous rows. but in ETA table each element in the varray(if there is one) is going to be the expected arrival time of buses on a particular route at that particular stop, and is different from the arrival time at a previous stop(i.e.row).
    but for my other table BUS_ROUTE i have 2 varrays describing the links and stops enroute. in quite a few procedures i have to loop through these arrays and perform some calculations in every iteration is varray the best way 2 go, or nested tables?
    Thank you
    Amina
    As an aside, external procedures tend by their very
    nature to be slow - there's an overhead incurred
    each time we step outside the database. Therefore
    you really ought to avoid using a C extproc unless
    your calculations really cannot be done in PL/SQL or
    a Java Stored Procedure.
    Also, before you go down the VARRAY route you should
    consider the virues of analytic functions, notably
    [url=http://download-west.oracle.com/docs/cd/B1050
    1_01/server.920/a96540/functions56a.htm#83619]LAG()[/u
    rl]. I think you really ought to do some
    benchmarking of parformance before you start afdding
    denormalised columns like ETA. You may find the
    overhead in maintaining those columns exceeds their
    perceived benefits.
    Cheers, APC

  • Java Stored Procedure SAXParser XML Schema Validation

    Using Oracle XML Developers Kit 10.2.0.2.0 - Production.
    Attempting to validate using XML Schema in a Java stored procedure with the code:
                   if ( schemaDoc == null )
                        // Obtain default connection
                        Connection conn = new OracleDriver().defaultConnection();
                        OraclePreparedStatement stmt = (OraclePreparedStatement) conn.prepareStatement("SELECT XmlDocObj FROM XmlDoc WHERE XmlDocNbr = 2");
                        OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
                        if ( rset.next() )
                             // get the XMLType
                             XMLType schemaXml = (XMLType)rset.getObject(1);
                             XSDBuilder builder = new XSDBuilder();
                             XMLSchema schemaDoc = (XMLSchema)builder.build(new InputSource(schemaXml.getInputStream()));
                   if ( inst == null )
                        inst = new ValidateCoreRequest();
                   ErrorHandlerImpl handler = inst.getNewErrorHandler();
    SAXParser saxParser = new SAXParser();
    saxParser.setXMLSchema(schemaDoc);
    saxParser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxParser.setErrorHandler(handler);
    saxParser.parse(new InputSource(new StringReader(docStr)));
    if( handler.validationError )
                        errorMsg[0] = handler.saxParseException.getMessage().substring(0, Math.min(199, handler.saxParseException.getMessage().length()));
    Never reports validation errors in the XML. Although the XDK Programmers Guide states "...you can use
    the oracle.xml.parser.schema.XSDBuilder class to build an XML schema and
    then configure the parser to use it by invoking the XMLParser.setXMLSchema()
    method. In this case, the XML parser automatically sets the validation mode to
    SCHEMA_STRICT_VALIDATION and ignores the schemaLocation and
    noNamespaceSchemaLocation attributes." No validation seems to occur. I have tried to set an xsi:noNamespaceSchemaLocation attribute on the root XML node, but this results in URL errors if the URL is not valid or schema build errors if the URL is valid, but does not point to a real location.
    It appears that without a schema location attribute, no schema validation occurs. Using setXMLSchema() with a database source does not seem to cause the schema location attributes to be ignored. At least for Java stored procedures.
    Does XML Schema validation work in the database for externally referenced schemas?
    Thank You,
    Art

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jan Vissers ([email protected]):
    I have two schemas A and B. A contains a java stored procedure which calls a java stored procedure stored in B. Upon resolving the "A" Java Stored Procedures I get the following error:
    ORA-29545: badly formed class: at offset 3093 of Adapter.TFADPBeschikbaarheid.sendAanvraag expecting a class-oracle.xml.parser.v2.XMLDocument but encountered a class-oracle.xml.parser.v2.XMLDocument.
    ... Question:
    it is expecting something which it has in fact encountered... SO!!!! What is the error.
    Thx,
    Jan<HR></BLOCKQUOTE>
    Try this:
    Edit your XSU installation script located on lib directory of Oracle XSU's distribution:
    Find the line:
    loadjava -r -v -u $USER_PASSWORD xmlparserv2.jar
    Replace by:
    loadjava -r -v -g public -u $USER_PASSWORD xmlparserv2.jar
    And installs your Oracle XSU again.
    Best regards, Marcelo.

  • Using JNDI from Java Stored Procedures

    Hi,
    we want to call external services (mostly via middle tier/J2EE) from within the database (9i Rel. 2) using Java Stored Procedures and JNDI.
    Does anybody have some hints/samples how to do this? Will we have to use oc4jclient.jar? If yes, how? Where can I find some more detailed documentation?
    Lot's of questions...
    Thank
    Matthias

    Uh, not JNI but JNDI you asked. And use of JNI should be generally discouraged unless there is absolutely no other way (like co-located CORBA code for decoupling+speed). Can you direct me to a HOW-TO Oracle DB JVM configuration page? I want to know how to configure the internal DB JVM in a hurry.
    Thank you,
    Bryan

  • SQL Developer and External Procedures not in tree.

    Does sql Dveloper add external procedures to the object browser tree? I have SQL Developer 1.5 and if you have external procedures/functions before your regular PLSQL objects they will not display in the tree. I can make the tree work but the tree still doesn't capture the externals. Am I doing something wrong or should this be a feature request?
    VSAMPLE1 shows the problem.
    VSAMPLE2 is a try to resolve...
    /* the problem.. */
    CREATE OR REPLACE package VSAMPLE_1 IS
         PROCEDURE foobar(feedname IN VARCHAR2);
    END VSAMPLE_1;
    CREATE OR REPLACE PACKAGE BODY VSAMPLE_1
    IS
         * Function Name:- canread
         * Description  :-This function checks the file will give any error or not while reading
         FUNCTION canread (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.canRead (java.lang.String) return int';
         * Function Name:- is_exist
         * Description  :-This function checks the existance of the filein the required folder
         FUNCTION is_exist (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.exists (java.lang.String) return int';
         * Function Name:- isDirectory
         * Description  :-This function checks the name provided by the user is a directory or not
         FUNCTION isDirectory (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.isDirectory (java.lang.String) return int';
         * Function Name:- isFile
         * Description  :-This function checks the name provided by the user is a file or not
         FUNCTION isFile (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.isFile (java.lang.String) return int';
         * Function Name:- isExist
         * Description  :-This function checks the existance of file,correctness of the directory provided by the user.
         * @Param file_name :- File Name in directory
         * @return retcode  :- Error checking while uploading the feed.
         FUNCTION isExist(file_name IN VARCHAR2,
                    is_dir       BOOLEAN)
              RETURN PLS_INTEGER
         IS
              retcode PLS_INTEGER := -1;
              v_errcode PLS_INTEGER;
              v_errtext      VARCHAR2(1000);
              l_section_name VARCHAR2(32) := 'isExist ' ;
         BEGIN
              IF VTMLOG.isDebugEnabled THEN
                   VTMLOG.debug(l_section_name,$$PLSQL_LINE, 'Checking existense of '||file_name);
              END IF;
              retcode   := is_exist(file_name);
              IF retcode = 1 THEN
                   IF is_dir THEN
                        retcode := isDirectory(file_name);
                   ELSE
                        retcode := isFile(file_name);
                   END IF;
                   IF retcode          = 1 THEN
                        retcode    := canread(file_name);
                        IF retcode != 1 THEN
                             VTMLOG.error(l_section_name,$$PLSQL_LINE, ' Can not read ' || file_name);
                        END IF;
                   ELSE
                        VTMLOG.error(l_section_name,$$PLSQL_LINE, ' Unable to check if ' || file_name || ' is directory or file ');
                   END IF;
              ELSE
                   VTMLOG.error(l_section_name,$$PLSQL_LINE, file_name || ' does not exist ');
              END IF;
              VTMLOG.debug(l_section_name,$$PLSQL_LINE, 'Leaving ' );
              RETURN retcode;
         EXCEPTION
         WHEN OTHERS THEN
              VTMLOG.SHOW_ERROR_MESSAGE(l_section_name,$$PLSQL_LINE);
              RAISE;
         END isExist;
         PROCEDURE foobar(feedname VARCHAR2)
         IS
                    retval PLS_INTEGER;
            BEGIN
              /* implementation omitted */
              retval := isExist('feed.txt',false);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END foobar;
    END VSAMPLE_1;
    /* This version at least shows the tree. But I can't reach the external by clicking in the navigation tree just the placeholders */
         PROCEDURE foobar(feedname IN VARCHAR2);
    END VSAMPLE_2;
    CREATE OR REPLACE PACKAGE BODY VSAMPLE_2
    IS
            FUNCTION canread (FILE IN VARCHAR2) RETURN NUMBER;
            FUNCTION is_exist (FILE IN VARCHAR2) RETURN NUMBER;
            FUNCTION isDirectory (FILE IN VARCHAR2) RETURN NUMBER;
            FUNCTION isFile (FILE IN VARCHAR2) RETURN NUMBER;
         * Function Name:- isExist
         * Description  :-This function checks the existance of file,correctness of the directory provided by the user.
         * @Param file_name :- File Name in directory
         * @return retcode  :- Error checking while uploading the feed.
         FUNCTION isExist(file_name IN VARCHAR2,
                    is_dir       BOOLEAN)
              RETURN PLS_INTEGER
         IS
              retcode PLS_INTEGER := -1;
              v_errcode PLS_INTEGER;
              v_errtext      VARCHAR2(1000);
              l_section_name VARCHAR2(32) := 'isExist ' ;
         BEGIN
              IF VTMLOG.isDebugEnabled THEN
                   VTMLOG.debug(l_section_name,$$PLSQL_LINE, 'Checking existense of '||file_name);
              END IF;
              retcode   := is_exist(file_name);
              IF retcode = 1 THEN
                   IF is_dir THEN
                        retcode := isDirectory(file_name);
                   ELSE
                        retcode := isFile(file_name);
                   END IF;
                   IF retcode          = 1 THEN
                        retcode    := canread(file_name);
                        IF retcode != 1 THEN
                             VTMLOG.error(l_section_name,$$PLSQL_LINE, ' Can not read ' || file_name);
                        END IF;
                   ELSE
                        VTMLOG.error(l_section_name,$$PLSQL_LINE, ' Unable to check if ' || file_name || ' is directory or file ');
                   END IF;
              ELSE
                   VTMLOG.error(l_section_name,$$PLSQL_LINE, file_name || ' does not exist ');
              END IF;
              VTMLOG.debug(l_section_name,$$PLSQL_LINE, 'Leaving ' );
              RETURN retcode;
         EXCEPTION
         WHEN OTHERS THEN
              VTMLOG.SHOW_ERROR_MESSAGE(l_section_name,$$PLSQL_LINE);
              RAISE;
         END isExist;
         PROCEDURE foobar(feedname VARCHAR2)
         IS
                    retval PLS_INTEGER;
            BEGIN
              /* implementation omitted */
              retval := isExist('feed.txt',false);
         EXCEPTION
              WHEN OTHERS THEN
                   RAISE;
         END foobar;
         * Function Name:- canread
         * Description  :-This function checks the file will give any error or not while reading
         FUNCTION canread (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.canRead (java.lang.String) return int';
         * Function Name:- is_exist
         * Description  :-This function checks the existance of the filein the required folder
         FUNCTION is_exist (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.exists (java.lang.String) return int';
         * Function Name:- isDirectory
         * Description  :-This function checks the name provided by the user is a directory or not
         FUNCTION isDirectory (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.isDirectory (java.lang.String) return int';
         * Function Name:- isFile
         * Description  :-This function checks the name provided by the user is a file or not
         FUNCTION isFile (FILE IN VARCHAR2)
              RETURN NUMBER AS LANGUAGE JAVA NAME 'com.myCompany.myApp.bulk.FileUtil.isFile (java.lang.String) return int';
    END VSAMPLE_2;
    /

    Hi,
    I am afraid that according to the error message, it seems that this issue is mainly related to third-party, since issues using oracle database are not supported here, you could consider posting this issue in its website to get supports.
    In addition, you could mark any reply as answer if it is helpful.
    Thanks for your understanding.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SQL Server connection in Java Stored Procedures

    Is it possible to establish a connection to microsoft sql server through java stored procedures. When I try to create a connetion to SQL Server I am getting the following exception in trace file
    java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
    at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
    at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
    at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
    at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    at java.sql.DriverManager.getConnection(DriverManager.java)
    The connection details are correct and I am able to connect when I run the java code externally. Thanks in advance for the help

    Can you connect to the MSSQL database from inside Oracle in (say) a SQL*Plus or SQL Developer session?
    In other words, is the problem in the Java or the database linkages? Are you using Heterogeneous Services or Transparent Gateways?
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Problem with external procedure

    Please,
    i'm doing some experiments in Microsoft Win2003 environment calling a c function as external procedures.
    I've build a sample using Dev-C++ that make a DLL (i don't know c language) named sysDLL.dll
    DllClass::DllClass(char *cmd)
    int num;
    num = system(cmd);
    I need only to execute some OS command from PL/SQL (rdbms 10.2).
    I've putted DLL in $ORACLE_HOME\bin.
    Then I've created library with this statement :
    Create Library scott.c_sysdll as 'C:\oracle\product\10.2.0\db_3\bin\sysdll.dll'
    and at the end I've created the procedure :
    create or replace procedure scott.shell(cmd IN varchar2)
    as language C
    library c_SysDll
    name "DllClass"
    parameters (cmd string);
    But when I execute this procedure from sql*plus I've always get :
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: Unable to load symbol from DLL
    ORA-06512: at "SCOTT.SHELL", line 1
    ORA-06512: at line 1
    Please help me, thanks !

    Suggest that you first make it much simpler. Do not object orientation. Use plain vanilla flavour C. And even before using C, use a kernel call instead. For example, the gethostname() is a standard Socket call that you will find on many operating system (including Windows & Unix).
    The following code sample illustrates (can be run as is via SQL*Plus):<font color="blue">
    -- specify the external library (shared lib on Unix, DLL on Windows)
    create or replace library libc as 'libc.sl';
    -- The kernel call that we're going to wrap with a PL/SQL function:
    --      int gethostname(char *hostname, size_t size);
    -- wrapping this API call with a PL/SQL function
    create or replace function gethostname( hostname OUT string, size_t binary_integer ) return binary_integer is
            external
            library libc
            name "gethostname"
            language C
            calling standard C
            parameters
                    hostname        STRING,
                    size_t          INT
    -- calling the kernel API routine from within PL/SQL
    set serveroutput on
    declare
            host$   varchar2(60);
            rc$     integer;
    begin
            rc$ := gethostname( host$, 60 );
            dbms_output.put_line( 'hostname is ['|| host$ ||'] return code=['|| TO_CHAR(rc$) || ']' );
    end;
    /</font>
    <p>
    Of course, the DLL name for Window is different than the Shared Library ('libc.sl') used in the above snippet. Do not have a Win32 Oracle platform to test on, but you should find this API call in the winsock.dll library.
    <p>
    As for writing your custom extproc in C. Plain vanilla C is something as follows:
    int dosomestuff()
      return( 123456 );
    <p>
    Remember that this function has to be exported in the DLL interface.
    <p>
    Also keep in mind that using extproc is usually the last option to pursue when dealing with Oracle development. The basic rules are as follows:
    1. Do it in SQL.
    2. If it cannot be done in SQL, do it as a PL/SQL proc
    3. If if cannot be done in PL/SQL. do it as a Java stored proc
    4. If if cannot be done in Java, do is as an external proc<p>
    The times that I need to resort to using Java is less than a handful (most obvious one is using Java to gain o/s command line access). I have never put external proc code into production as we have yet to have a need for something so exceptional, that it cannot be done using SQL, PL/SQL or Java as the last resort.

Maybe you are looking for