Java stored procedure failes to create.

Hi All,
I have a java program with following import statement.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
Basically I am trying to make a HTTP post inside the jave code.
My code complies properly but when I try to create the stored precudere I get the error
"Procedure created with compilation errors."
Any Idea what is causing the problem.
Thanks in advance,
Bikram

Hi Schoeib,
Thanks for your reply.
I found the problem, the env variable Path was not properly defined.
I am getting another issue now.Is there any restriction in accessing non static reference from the main class (which is used for creating the stored procedure).
Static Wrapper --> non static class (All in one Jar).
The compilation is okay ,even java stored proc got created,but when I execute the proc I get "no method mymethod in class myclass"
Any Idea.
Thanks & regards,
Bikram

Similar Messages

  • Calling Java Stored Procedure failed SQLXML

    I tried to upload a simple class to Oracle in which I want to use java.sql.SQLXML class using:
    loadjava -u user/passwd@host:1521:xyz -v -resolve C:\develop\workspaces\Test\src\lbb\apc\test\JavaStoredProcedureTest.java
    loadjava answers with:
    creating : source lbb/apc/test/JavaStoredProcedureTest
    loading  : source lbb/apc/test/JavaStoredProcedureTest
    resolving: source lbb/apc/test/JavaStoredProcedureTest
    errors   : source lbb/apc/test/JavaStoredProcedureTest
        ORA-29535: Quelle erfordert Neukompilierung
        lbb/apc/test/JavaStoredProcedureTest:6: cannot find symbol
        symbol  : class SQLXML
        location: package java.sql
        import java.sql.SQLXML;Then I found that the Oracle JDBC driver does not support the SQLXML type, thus changing my program to use XMLType:
    XMLType sqlXml = (XMLType)rs.getSQLXML(1);but it doesn't help as well as it doesn't help to use
    Clob clob = rs.getClob(1);Finally I tried (and failed) to use
    Object obj = rs.getObject(1);
    results in:
    java.sql.SQLException: ORA-29532:Java call terminated by uncaught Java exception:What can I do to solve this problem?

    I wrote it for an example. sorry i should be clear.
    Here is the code i am running check WORKING & NOT WORKING lines. What am i missing
    PL SQL package
    CREATE OR REPLACE PACKAGE BODY APPS.hypr_Reference_designator as
    function hypr_xsl ( dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
    return varchar2
    as language java name 'hypr_ref_designator_xsl.hypr_xsl(java.lang.String,java.lang.String) return java.lang.String';
    procedure hypr_xsl(dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
       is
       itemNum VARCHAR2(30);
       db Varchar2(30);
       print_string varchar2(200);
       begin
          db:=dbInstance;
            itemNum:=Parent_ItemNum;
          print_string := hypr_xsl(db,itemNum);  --NOT WORKING
                print_string := hypr_xsl('DEV','123'); --WORKING
          commit;
          DBMS_OUTPUT.PUT_LINE(print_string || db || itemNum);
       end hypr_xsl;
    END hypr_Reference_designator;Java Stored Procedure
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS.HYPR_REF_DESIGNATOR_XSL as import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    import java.util.Properties;
    public class hypr_ref_designator_xsl {
        public hypr_ref_designator_xsl() {
        public static void main(String[] args) {
    public static String hypr_xsl(String  dbinstance, String parent_itemNum) {
    System.out.print(dbinstance);
    System.out.print(parent_itemNum);
    return "";
    //does some process here
    }

  • Deploying Java Stored Procedure Failed

    Hello,
    I have a java class and when I try to deploy using jdeveloper to oracle database 9i, I am getting the following errors.
    What could be the reasons
    Error while creating class pass/com/Card
    ORA-01031: insufficient privilegesjava.sql.SQLException: ORA-01031: insufficient privileges
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)

    knutst,
    I don't use JDeveloper, but I would suggest trying to do these operations not via JDeveloper in order to see whether the problem is with JDeveloper's wizards, or not.
    Compile the java classes using "javac" -- from the command line, then load them into the database using "loadjava" -- also from the command line.
    Good Luck,
    Avi.

  • APEX fails with Java stored procedure that creates a JDBC connection

    Hello!
    We are facing a strange problem since we have upgraded from Oracle 10g and Apache to Oracle 11g with Embedded Gateway.
    Here is what we do:
    ** APEXX calls a PL/SQL package function "OPEN_CONNECTION" that wraps a Java stored procedure called "openConnection".*
    FILE_READER_REMOTE_API.openConnection(user, password, host, port, service);
    ** The Java stored procedures "openConnection" opens a JDBC connection to an other database:*
    public class FileReaderRemote {
    private static Connection conn = null;
    private static DefaultContext remoteContext = null;
    public static void openConnection(String user, String password, String host, String port, String service) throws SQLException {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    java.util.Properties props = new java.util.Properties();
    props.put ("user", user);
    props.put ("password", password);
    //props.put ("database", "//" + host + ":" + port + "/" + service);
    props.put ("database", host + ":" + port + ":" + service);
    props.put("v$session.program", "FileReaderRemote2");
    // Connect to the database
    remoteContext = Oracle.getConnection("jdbc:oracle:thin:", props);
    This procedure used to work fine before the upgrade, but now we see the following:
    * It still works when called directly from TOAD or SQL*Plus, even under the user ANONYMOUS.
    * When called from APEX and the target database is Oracle 11g, it still works.
    * When called from APEX and the target database is Oracle 10g, it takes several minutes and we receive this error:
    *"Socket read timed out"*
    We have tested the following workaround:
    We have created a database link to our own database and called the stored procedure through that database link.
    FILE_READER_REMOTE_API.openConnection*@loopback*(user, password, host, port, service);
    This works, but is not really an option.
    I hope some one of you can explain this strange behaviour to me.
    Best regards,
    Matthias

    You wrote
    "Java stored procedures -- by definition - are stored in the 8i rdbms. !!"
    From the Oracle8i Java Stored Procedures Developer's Guide
    Release 8.1.5
    A64686-01
    "If you create Java class files on the client side, you can use loadjava to upload them into the RDBMS. Alternatively, you can upload Java source files and let the Aurora JVM compile them. In most cases, it is best to compile and debug programs on the client side, then upload the class files for final testing within the RDBMS"
    This means that you can create shared classes that are used on both the client and server side. The source does not need to reside within the server (according to their documentation). Please also note the following from the Oracle8i JDBC Developer's Guide and Reference Release 8.1.5 A64685-01 for using the getConnection() method on the server:
    "If you connect to the database with the DriverManager.getConnection() method, then use the connect string jdbc:oracle:kprb:. For example:
    DriverManager.getConnection("jdbc:oracle:kprb:");
    Note that you could include a user name and password in the string, but because you are connecting from the server, they would be ignored."
    So if you're coding a shared class that is to run on both the client and server side, you might do something like this:
    Connection conn =
    DriverManager.getConnection(
    System.getProperty("oracle.server.version") == null
    ? "jdbc:oracle:thin:@hostname:1521:ORCL"
    : "jdbc:oracle:kprb:"),
    "youruserid","yourpassword");
    As stated earlier, the userid and password are supposedly ignored for server connections retrieved in this manner. I haven't tried this yet, but it is documented by Oracle.
    Regards,
    Steve
    null

  • Creating Threads in Java Stored procedures

    Can I create threads inside Java Stored procedures?
    or is there a restriction?
    Thanks
    Kal

    Can I create threads inside Java Stored procedures?
    or is there a restriction?
    Thanks
    Kal Hi Kal,
    I don't mean to be rude, but have you tried it? Personally, I
    haven't tried it (since I didn't have the need).
    You don't say what version of Oracle DBMS you are using, but I
    am using 8.1.7.3 on Solaris 7, and according to Oracle's
    "Oracle 8i Java Developer's Guide", there is no restriction
    (of-course, that depends on what you call a "restriction" :-)
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83728/03writ11.htm#1003094
    Hope this helps.
    Good Luck,
    Avi.

  • How to create a java stored procedure

    hi @all
    i have no expierence with java
    my plan
    i want to select (create view) data from a table which is located in sql server db
    with a java stored procedure.
    i won't use the way Generic Connectivity/Transparent Gateways (http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76960/hs_admin.htm).
    can anybody help me?

    Download JDeveloper. Look for examples on http://otn.oracle.com.

  • How to create java stored procedure from oracle(Dastageer)

    how to create java stored procedure from oracle-please help me to create the procedure.

    Hi,
    This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question in the appropriate forum.
    Thanks,
    RK.

  • Problem In creating Java stored procedure- Urgent

    Hi Guys,
    I try to create a simple Java stored procedure but I get the following error message. Can you help me to sort out the problem please?.
    SQL> create or replace and compile java source named "Hello"
    2 as
    3 public class Hello {
    4 public static String hello()
    5 {
    6 return "Hello Oracle World";
    7 }
    8 }
    9 /
    Warning: Java created with compilation errors.
    SQL> show error java source Hello;
    No errors.
    Thanks in advance
    anthony
    null

    I had a similar issue, the reason for that was picking the incorrect partner link.
    Make sure the name of the selected partner link in the invoke output variable is matching with the Assign, in you case lets say you mapped the
    Invoke
    output variable is invoke_1_CallStoredProcedure_OutputVariable ( not nvoke_1_CallStoredProcedure_OutputVariable_1)
    From
    <Invoke_1_CallStoredProcedure_OutputVariable>
    <LF_STATUS>
    To
    P_lf_status ( variable)
    most of the time multiple variables are created when we try to select the output variable s in the Invoke.

  • Runtime.Exec() fails -- Through java stored procedure in Oracle8i

    HI,
    I HAVE A JAVA STORED PROCEDURE WHICH EXECUTES
    A HOST COMMAND USING Runtime.Exec().
    BUT IT IS NOT WORKING.
    RIGHTS FOR THE USER HAVE BEEN GIVEN USING
    Dbms_grant_persmission(). The database in on
    SUN SOLARIS. THE EXITVALUE OF THE RUNTIME.EXEC COMMAND IS 255(SEGMENTATION
    ERROR - CORE DUMPED).
    PLEASE LET ME KNOW WHERE THE PROBLEM LIES. THE FUNCTION IS WORKING WELL IF THE DATABASE IS ON NT PLATFORM BUT FAILS TO WORK WHEN I STORED THE PROCEDURE IN A DATABASE RUNNING ON SUN SOLARIS AND TRIED TO EXECUTE A SOLARIS COMMAND THROUGH THE PROCEDURE.
    Thanks for ur interest!
    with best regards,
    Mathan

    I have similar problem on HP-UX, I would appreciate if you
    somehow were able to solve it.
    Thanks
    Rahul Shah

  • Is is possible to create Socket using Java Stored Procedures/Function(Ora)?

    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?
    OR
    How I can send a message from oracle to Java Desktop Application which is working like server program?
    Please Guide !!

    J3Ganesh wrote:
    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?No, Oracle was very careful to take that feature out of the JDK provided in Oracle 10/11, but you can buy that feature back for, if I remember correctly, about 5000 dollars. (I actually raised a service request on this and then told my rep what I thought about the answer I received--some thing along the line of money grubbing so and so....)
    How I can send a message from oracle to Java Desktop Application which is working like server program?You can make a table and poll it from time to time from the Java side and write and commit what ever you want to the table. I do not know any way to send a signal from Oracle DB an external Java application--Java or PL/SQL stored procedure.

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

  • 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

  • Forcing a commit in a JAVA stored procedure

    Hi,
    I am using a java stored procedure which updates few tables ;only after it completes the call the commit is happening;But i wanted it to commit the tables as and when the processing happens not at the end of the call to java stored procedure because the GUI is polling for changes into the database which will be updated by the stored procedure.
    i have already set the connection.setAutoCommit(true) in the code.
    Can somebody suggest a solution ?
    Thanks in advance
    varun

    Jason,
    Works for me on Oracle 10.1.0.3 running on Red Hat Enterprise Linux AS release 3 (Taroon).
    Java code:
    import java.sql.*;
    * Oracle Java Virtual Machine (OJVM) test class.
    public class OjvmTest {
      public static void test() throws SQLException {
        Connection conn = DriverManager.getConnection("jdbc:default:connection:");
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
          ps = conn.prepareStatement("select 'TEST' from SYS.DUAL");
          rs = ps.executeQuery();
          if (rs.next()) {
            System.out.println(rs.getString(1));
        finally {
          if (rs != null) {
            try {
              rs.close();
            catch (SQLException sqlEx) {
              System.err.println("Error ignored. Failed to close result set.");
          if (ps != null) {
            try {
              ps.close();
            catch (SQLException sqlEx) {
              System.err.println("Error ignored. Failed to close statement.");
    }And my PL/SQL wrapper:
    create or replace procedure P_J_TEST as language java
    name 'OjvmTest.test()';And here is how I execute it in a SQL*Plus session:
    set serveroutput on
    exec dbms_java.set_output(2000)
    exec p_j_testGood Luck,
    Avi.

  • Java Stored Procedures with 9.2.0.5

    We are attempting to create Java Stored Procedures and we receive the following errors when attempting to do so, not sure why this is happening
    C:\WSADWorkspaces\siscore\siscoreCore\source\com\amfam\siscore\integration\service>loadjava -user sis_user/is3l
    l@aw0u -oci8 -resolve MaintainService.class
    Error while creating JAVA$CLASS$MD5$TABLE
    ORA-01031: insufficient privileges
    Error while getting old MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while creating CREATE$JAVA$LOB$TABLE
    ORA-01031: insufficient privileges
    Error while deleting com/amfam/siscore/integration/service/MaintainTigerService from lob table
    ORA-00942: table or view does not exist
    Error while loading class com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while creating class com/amfam/siscore/integration/service/MaintainTigerService
    ORA-29506: invalid query derived from USING clause
    Error while deleting MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    Error while deleting MD5 of com/amfam/siscore/integration/service/MaintainTigerService
    ORA-00942: table or view does not exist
    The following operations failed
    class com/amfam/siscore/integration/service/MaintainTigerService: creation
    exiting : Failures occurred during processing
    C:\WSADWorkspaces\siscore\siscoreCore\source\com\amfam\siscore\integration\service>

    Jay,
    You ned to grant user sis_user permission to load java classes into the database. Please refer to the Java Developer's Guide which is part of the Oracle documentation and can be accessed via:
    http://tahiti.oracle.com
    Good Luck,
    Avi.

  • Missing Defines Error in Simple Java Stored Procedure

    Anyone have any suggestions on what might be causing the unusual behavior described below? Could it be a 10g java configuration issue? I am really stuck so I'm open to just about anything. Thanks in advance.
    I am writing a java stored procedure and am getting some SQLException's when executing some basic JDBC code from within the database. I reproduced the problem by writing a very simple java stored procedure which I have included below. The code executes just fine when executed outside of the database (10g). Here is the output from that execution:
    java.class.path=C:\Program Files\jEdit42\jedit.jar
    java.class.version=48.0
    java.home=C:\j2sdk1.4.2_04\jre
    java.vendor=Sun Microsystems Inc.
    java.version=1.4.2_04
    os.arch=x86
    os.name=Windows XP
    os.version=5.1
    In getConnection
    Executing outside of the DB
    Driver Name = Oracle JDBC driver
    Driver Version = 10.1.0.2.0
    column count=1
    column name=TEST
    column type=1
    TEST
    When I execute it on the database by calling the stored procedure I get:
    java.class.path=
    java.class.version=46.0
    java.home=/space/oracle/javavm/
    java.vendor=Oracle Corporation
    java.version=1.4.1
    os.arch=sparc
    os.name=Solaris
    os.version=5.8
    In getConnection
    We are executing inside the database
    Driver Name = Oracle JDBC driver
    Driver Version = 10.1.0.2.0
    column count=1
    column name='TEST'
    column type=1
    MEssage: Missing defines
    Error Code: 17021
    SQL State: null
    java.sql.SQLException: Missing defines
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
    at oracle.jdbc.driver.OracleResultSetImpl.getString(Native Method)
    at OracleJSPTest.test(OracleJSPTest:70)
    Here is the Java code:
    // JDBC classes
    import java.sql.*;
    import java.util.*;
    //Oracle Extensions to JDBC
    import oracle.jdbc.*;
    import oracle.jdbc.driver.OracleDriver;
    public class OracleJSPTest {
    private static void printProperties(){
         System.out.println("java.class.path="+System.getProperty("java.class.path"));
         System.out.println("java.class.version="+System.getProperty("java.class.version"));
         System.out.println("java.home="+System.getProperty("java.home"));
         System.out.println("java.vendor="+System.getProperty("java.vendor"));
         System.out.println("java.version="+System.getProperty("java.version"));
         System.out.println("os.arch="+System.getProperty("os.arch"));
         System.out.println("os.name="+System.getProperty("os.name"));
         System.out.println("os.version="+System.getProperty("os.version"));
    private static Connection getConnection() throws SQLException {
         System.out.println("In getConnection");      
    Connection connection = null;
    // Get a Default Database Connection using Server Side JDBC Driver.
    // Note : This class will be loaded on the Database Server and hence use a
    // Server Side JDBC Driver to get default Connection to Database
    if(System.getProperty("oracle.jserver.version") != null){
              System.out.println("We are executing inside the database");
              //connection = DriverManager.getConnection("jdbc:default:connection:");                    
              connection = new OracleDriver().defaultConnection();
    }else{
         System.out.println("Executing outside of the DB");
         DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
         connection = DriverManager.getConnection("jdbc:oracle:thin:@XXX.XXX.XXX.XX:XXXX:XXXX","username","password");
    DatabaseMetaData dbmeta = connection.getMetaData();
    System.out.println("Driver Name = "+ dbmeta.getDriverName());
    System.out.println("Driver Version = "+ dbmeta.getDriverVersion());
    return connection;
    public static void main(String args[]){     
         test();     
    public static void test() {   
         printProperties();
    Connection connection = null; // Database connection object
    try {
         connection = getConnection();
         String sql = "select 'TEST' from dual";
         Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery(sql);     
         ResultSetMetaData meta = rs.getMetaData();     
         System.out.println("column count="+meta.getColumnCount());
         System.out.println("column name="+meta.getColumnName(1));
         System.out.println("column type="+meta.getColumnType(1));
         if(rs.next()){
              System.out.println(rs.getString(1));
    } catch (SQLException ex) { // Trap SQL Errors
         System.out.println("MEssage: " + ex.getMessage());
         System.out.println("Error Code: " + ex.getErrorCode());
         System.out.println("SQL State: " + ex.getSQLState());
         ex.printStackTrace();
    } finally {
    try{
    if (connection != null || !connection.isClosed())
    connection.close(); // Close the database connection
    } catch(SQLException ex){
    ex.printStackTrace();
    Message was edited by:
    jason_mac

    Jason,
    Works for me on Oracle 10.1.0.3 running on Red Hat Enterprise Linux AS release 3 (Taroon).
    Java code:
    import java.sql.*;
    * Oracle Java Virtual Machine (OJVM) test class.
    public class OjvmTest {
      public static void test() throws SQLException {
        Connection conn = DriverManager.getConnection("jdbc:default:connection:");
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
          ps = conn.prepareStatement("select 'TEST' from SYS.DUAL");
          rs = ps.executeQuery();
          if (rs.next()) {
            System.out.println(rs.getString(1));
        finally {
          if (rs != null) {
            try {
              rs.close();
            catch (SQLException sqlEx) {
              System.err.println("Error ignored. Failed to close result set.");
          if (ps != null) {
            try {
              ps.close();
            catch (SQLException sqlEx) {
              System.err.println("Error ignored. Failed to close statement.");
    }And my PL/SQL wrapper:
    create or replace procedure P_J_TEST as language java
    name 'OjvmTest.test()';And here is how I execute it in a SQL*Plus session:
    set serveroutput on
    exec dbms_java.set_output(2000)
    exec p_j_testGood Luck,
    Avi.

Maybe you are looking for

  • Time Capsule as Itunes Media Storage

    I'm thinking about buying a Time capsule, but I want to know if that's what I really need. 1) My main problem is that I can't use my MacBook to hear music, watch movies or sync my Iphone 4 through my apartment 'cause my Library is in an External hard

  • WM -RFissue-

    Hi, I am doing RF configuration in WM .I am not able to assign more than one queue ( or Person) for GR  area or GI so that I can distribute TO's to that queues. If it succeeds then through BADI I believe I can assign TO's directly. Please provide me

  • What is the Difference btwn PORT and SOCKET

    Hai, what is the diff. between Port and Socket and is Port related to Hardware?

  • Cannot Unlock Object

    Migration to CS4 has created a serious problem for me, which will cost many hundreds of man-hours to repair, possibly thousands. This is what happened. I design collectors cards with InDesign. On a template file, the master layout is copied to the do

  • How to parse text file (.eml) to get index of line, that contains Subject, From field, and base64 decoded Body

    Hello, Dear Colleagues. Help me please with next deal. As input I have .eml file: x-sender: [email protected] x-receiver: *************************** Received: from ***** with Microsoft SMTPSVC(7.5.7601.17514); Fri, 20 Mar 2015 12:43:03 +0200