Deploy Java Classes to the Database 2

Hi,
I have made a program with JDeveloper, and with the function deploy I can store the code in the Oracle database.
But now I want to use the loadjava tool.
I put all the class files in one jar file and used the following command:
(when I put the .java files in the jar file it works fine, but I want to load the .class files)
loadjava -user test/test@xx–resolve file.jar
The following errors I get:
errors : class test/AnalyzeAccNum
ORA-29534: referenced object XX.test/QueryManager could not be resolved
ORA-29545: badly formed class:
errors : class test/AnalyzeBalNew
ORA-29534: referenced object XX.test/ReadEB could not be resolved
ORA-29545: badly formed class:
errors : class test/AnalyzeBalOld
ORA-29534: referenced object XX.test/ReadEB could not be resolved
ORA-29545: badly formed class:
errors : class test/QueryManager
ORA-29545: badly formed class:
errors : class test/ReadEB
ORA-29534: referenced object XX.test/FetchBankAccountID could not be resolved
ORA-29545: badly formed class:
errors : class test/RecognizeAndSaveLine
ORA-29534: referenced object XX.test/AnalyzeStatementLine could not be resolved
ORA-29545: badly formed class:
The following operations failed
class test/AnalyzeAccNum: resolution
class test/AnalyzeBalNew: resolution
class test/AnalyzeBalOld: resolution
class test/AnalyzeDefLin: resolution
class test/AnalyzeDesLin: resolution
class test/AnalyzeDetLin: resolution
class test/AnalyzePayRef: resolution
class test/AnalyzeStaNum: resolution
class test/AnalyzeStatementLine: resolution
class test/BankCheck: resolution
class test/FetchBankAccountID: resolution
class test/FormatLayout: resolution
class test/FormatLayoutTag: resolution
class test/InsertInvoiceLine: resolution
class test/InsertStatement: resolution
class test/InsertStatementLine: resolution
class test/ProcessStatementLine: resolution
class test/QueryManager: resolution
class test/ReadEB: resolution
class test/RecognizeAndSaveLine: resolution
exiting : Failures occurred during processing
In JDeveloper it works fine, and I changed nothing in de code.
What am I doing wrong?
Thanks in advance.

To make it more simple I made a new java file with only this code:
package project1;
public class test {
    public static void test() {
        System.out.println("test");
}I used the following command to make a class file:
javac -source 1.3 -target 1.3 test.java
I used the following command for loadjava:
loadjava -user test/test@database -resolve -verbose test.class
this are the errors I get:
arguments: '-user' 'test/test@database' '-resolve' '-verbose' 'test.class'
creating : class project1/test
loading : class project1/test
resolving: class project1/test
errors : class project1/test
ORA-29545: badly formed class:
The following operations failed
class project1/test: resolution
exiting : Failures occurred during processing
If I do this all in JDeveloper it works fine when i want to deploy the .java file. But when I select the .class to deploy I get this message:
Invoking loadjava on connection 'database' with arguments:
-order -resolve -debug -force -thin -verbose
creating : class project1/test
loading : class project1/test
Oracle Jdbc tracing is not avaliable in a non-debug zip/jar file
resolving: class project1/test
errors : class project1/test
ORA-29545: badly formed class:
The following operations failed
class project1/test: 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: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)
#### Deployment incomplete. #### Jun 20, 2007 8:51:09 AM
*** Note ***
One possibility for the deployment failure is that the target Database may not support JDK version 1.3. Updating your Project Properties compiler Source & Target to an earlier release could fix this problem.
Someone who knows what the problem is?
Message was edited by:
KdeGraaf

Similar Messages

  • Load java class into the database 10g

    Hi ,
    We have a program which creates pdf files by using bi publisher.for this program we r using some java package to create a directory in unix whenever invoiceprint program runs.
    Now i need to load this class into database,so how can i load this class into database.
    I got some samples and docs from google but i was confused with those wether i should load from Oracle/applmgr user.
    So Could any one please tell me how can i load java class into oracle database.
    I am verymuch thankful for your kind help.Its an emergency issue for me.
    Thanks,
    YMR

    Hi,
    http://www.oracle-training.cc/teas_elite_util9.htm
    SS

  • How to generate the java classes of the database tables

    Hi,
    I am using Sun One 4 update1 CE for generate java classes of tables from an Oracle database. I have got the database schema file. However, when I right clicked on the database schema file, there is no selection for "Generate Java...".
    Besides, when I was trying to use database Schema template from the project tab in the explore window by double click on the project, after following all the procedures of inputing the database url, driver, uername, password, and select the table to generate, the following exception came out:
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: Posted StackTrace
    Annotation: Exception occurred in Request Processor
    org.openide.util.RequestProcessor$Holder: Posted StackTrace(task org.netbeans.core.ModuleActions$1@e4b7d3 [-31035, 1, -1])
    at org.openide.util.RequestProcessor$Holder.fillInStackTrace(RequestProcessor.java:300)
    at java.lang.Throwable.<init>(Throwable.java:195)
    at java.lang.Exception.<init>(Exception.java:41)
    at org.openide.util.RequestProcessor$Holder.<init>(RequestProcessor.java:280)
    at org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:333)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:100)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:73)
    at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.openide.explorer.view.TreeView.invokeAction(TreeView.java:878)
    at org.openide.explorer.view.TreeView$PopupSupport.mouseClicked(TreeView.java:958)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:208)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:207)
    at java.awt.Component.processMouseEvent(Component.java:5096)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3174)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: <no message>
    java.lang.NullPointerException
    at org.netbeans.modules.projects.ProjectDataObject.add(ProjectDataObject.java:204)
    at org.netbeans.modules.projects.AddNewAction.performAction(AddNewAction.java:88)
    at org.openide.util.actions.NodeAction.actionPerformed(NodeAction.java:167)
    at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:105)
    at org.openide.util.Task.run(Task.java:152)
    [catch] at org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:622)
    Any suggestions to the solution of these problems are greatly appreciated. Thanks.
    Yi-Xiong

    you also could use this to generate java beans out of database tables:
         * Convert SQL type code to corresponding Java class.
         * @param sqlType One of java.sql.Types.xxx.
         * @return Class that corresponds to the given type.
        public static Class toClass(int sqlType) {
            Class result = null;
            switch (sqlType) {
            case Types.BIGINT :
            case Types.INTEGER :
            case Types.SMALLINT :
            case Types.TINYINT :
                result = Integer.class;
                break;
            case Types.BIT :
            case Types.BOOLEAN :
                result = Boolean.class;
                break;
            case Types.CHAR :
                result = Character.class;
                break;
            case Types.DATE :
            case Types.TIMESTAMP :
                result = java.util.Date.class;
                break;
            case Types.DECIMAL :
            case Types.DOUBLE :
            case Types.FLOAT :
                result = BigDecimal.class;
                break;
            case Types.NULL :
                result = null;
                break;
            case Types.LONGVARCHAR :
            case Types.VARCHAR :
            default :
                result = String.class;
                break;
            return result;
        }//toClass()
         * Create a Java bean (source file) to map a database table. The class name is the table name, the bean
         * properties are the table columns. Each column will result in a property with a corresponding set() and
         * get() method.
         * @param connection Database connection to load table from.
         * @param tableName Name of table to create the bean for.
         * @param packageName Name of package for Java class.
         * @param className Name of Java class to create.
         * @param superClass Optional name of super class.
         * @return Java source of container class.
         * @throws SQLException, IOException
         * @see <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Data Access Object </a>
        public static String getTableBean(Connection connection, String tableName, String packageName, String className, String superClass)
                throws SQLException, IOException {
            String result = null;
            if (connection != null && tableName != null) {
                //read table columns:
                DatabaseMetaData dmd = connection.getMetaData();
                ResultSet resultSet = dmd.getColumns(null, "%", tableName, null);
                Properties props = new Properties();
                if (resultSet != null) {
                    while (resultSet.next()) { //for each table
                        String name = resultSet.getString("COLUMN_NAME");
                        int type = resultSet.getInt("DATA_TYPE");
                        props.setProperty(name, ""+type);
                    }//next table
                }//else: resultSet unavailable
                Set imports = new HashSet();
                StringBuffer sb1 = new StringBuffer(); //fields
                StringBuffer sb2 = new StringBuffer(); //methods
                StringBuffer sb3 = new StringBuffer(); //toString()
                Enumeration enum = props.keys();
                while (enum.hasMoreElements()) {
                    String columnName = (String) enum.nextElement();
                    //change first character of column name to lower case:
                    String fieldName = columnName.substring(0, 1).toLowerCase() + columnName.substring(1);
                    //datat type:
                    String stype = props.getProperty(columnName, ""+Types.VARCHAR);
                    int type = (new Integer(stype)).intValue();
                    Class javaClass = toClass(type);
                    String typeName = "String"; //default
                    if (javaClass != null) {
                        String javaClassName = javaClass.getName();
                        int lastDot = javaClassName.lastIndexOf('.');
                        if (lastDot >= 0) {
                            typeName = javaClassName.substring(lastDot + 1);
                        if (!javaClassName.startsWith("java.lang.")) {
                            imports.add(javaClassName);
                    //field:
                    sb1.append("    /** ");
                    sb1.append(columnName);
                    sb1.append(" */\n");
                    sb1.append("    private ");
                    sb1.append(typeName);
                    sb1.append(" ");
                    sb1.append(fieldName);
                    sb1.append(" = null;\n");
                    //toString() method:
                    sb3.append("        sb.append(\",");
                    sb3.append(fieldName);
                    sb3.append("=\");\n");
                    sb3.append("        sb.append(");
                    sb3.append(fieldName);
                    sb3.append(");\n");
                    //set method:
                    sb2.append("    /**\n");
                    sb2.append("     * Set ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @param value ");
                    sb2.append(columnName);
                    sb2.append(" to set.\n");
                    sb2.append("     */\n");
                    sb2.append("    public void set");
                    sb2.append(columnName);
                    sb2.append("(");
                    sb2.append(typeName);
                    sb2.append(" value) {\n        ");
                    sb2.append(fieldName);
                    sb2.append(" = value;\n    }\n\n");
                    //get method:
                    sb2.append("    /**\n");
                    sb2.append("     * Get ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @return ");
                    sb2.append(columnName);
                    sb2.append(".\n     */\n");
                    sb2.append("    public ");
                    sb2.append(typeName);
                    sb2.append(" get");
                    sb2.append(columnName);
                    sb2.append("() {\n");
                    sb2.append("        return ");
                    sb2.append(fieldName);
                    sb2.append(";\n    }\n\n");
                }//next column
                //build class source code:
                StringBuffer sb = new StringBuffer();
                sb.append("/* $Header: /data/iComps/icf/prg/java/src/de/icomps/sql/JDBCUtils.java 9     24.10.03 14:25 Hilpert $ */\n");
                sb.append("package ");
                sb.append(packageName);
                sb.append(";\n\n");
                //import statements:
                Iterator iterator = imports.iterator();
                while (iterator.hasNext()) {
                    String jcn = (String) iterator.next();
                    sb.append("import ");
                    sb.append(jcn);
                    sb.append(";\n");
                if (imports.size() > 0) {
                    sb.append("\n");
                //class:
                sb.append("/**\n");
                sb.append(" * Container class to store data of one record (row) of table '"+tableName+"'.\n");
                sb.append(" *\n");
                sb.append(" * @version $Revision: 9 $ ($Date: 24.10.03 14:25 $)\n");
                sb.append(" * @author $Author: Hilpert $\n");
                sb.append(" */\n");
                sb.append("public class ");
                sb.append(className);
                if (superClass != null) {
                    sb.append(" extends ");
                    sb.append(superClass);
                sb.append(" {\n\n");
                //fields:
                sb.append(sb1.toString());
                //methods:
                sb.append("\n\n");
                sb.append(sb2.toString()); //methods
                //overwrite toString() method:
                sb.append("    /**\n");
                sb.append("     * Overwrite super.\n");
                sb.append("     *\n     * @return String representation of the object.\n");
                sb.append("     */\n");
                sb.append("    public String toString() {\n");
                sb.append("        StringBuffer sb = new StringBuffer(super.toString());\n\n");
                sb.append(sb3.toString());
                sb.append("\n        return sb.toString();\n");
                sb.append("    }\n\n");
                sb.append("}//"+className);
                result = sb.toString();
            }//else: input unavailable
            return result;
        }//getTableBean()

  • Deploy Java class to database from jDeveloper

    In 10g version I could create a deployment profile for deploying java class directly to the database from within jdeveloper. Looks like when you create a deployment profile in 11g that is no longer an option. Has the process changed, or was that functionality flat out removed?

    Hi,
    what about
    Nwe --> Database Tier --> Database Files --> Load Java and Java Stored Procedure
    Frank

  • Tool to create Java Object classes using the Database Tables

    Hi,
    Is their any tools or utility available to create the Java Object Classes using the Database Tables as input.
    Lets Say I am having the Employee, Employee_Salary tables in the Database.The utility has to create the Java Object classes with the relation.
    Please Help...
    Thx..

    Hm, for generating regular Java classes I wouldn't know one from memory. But I suggest you start searching in for example the Eclipse marketspace for a third party plugin that can do it. If all fail, you could always use Hibernate Tools from the Jboss Tools Eclipse plugin set to generate Hibernate/JPA entities and then strip the annotations from them to turn them into regular POJO classes.
    How many tables are we talking about anyway? It might be less effort to just create the classes with properties and then use an IDE to generate getters and setters for them.

  • I want to call External Java class from the PL/SQL

    Hi,
    I am using Oracle Apps R11i (11.5.7), I wanted to call external Java class from the PL/SQL. This external Java class is residing in another application server.
    How do I do this.
    I know one way. Develop C routine in Oracle Apps to call external java class and call this C routine from the PL/SQL.
    Is there any simple method available? or any other method?
    Thanks in advance.
    -Venkat

    First of all, this is a Java application you're talking about, right (i.e. it has a main() function)? It's not just a class that you're trying to instantiate is it? If it's an application, you obviously have to start a new virtual machine to run it (rather than using the virtual machine built into the database like stored java). I'm a little leary of your mention of an "application server" as this would more commonly mean that a virtual machine is already over there running with access to this class. In which case, you'd typically interface with SOAP or some other RPC API.
    All that aside, as long as you have physical disc access (through NFS or whatever) to the class file, you could use a java wrapper class with a system call to do this. In fact, there is a thread in just the last day or so on this very forum that has the code to do just that (see " Invoking OS Commands from PL/SQL"). However, it's worth noting that the virtual machine will be running on the database server in this case and not the application server.

  • Where deploy Java class in XI 3.0?

    Hi all,
      I have created a Java class for Jco connection and I have created .jar file.
    At this point where must I copy .jar file in XI server???
    And what activities must I do for using my classes with message mapping???
    Thans in advance,
          Michele.

    Michele,
    We are facing a quite similar situation with XI 3.0.  What we've found is that the only methods available for integrating Java code is either
    a) Import a JAR archive into a specific software component
    b) Create a Java proxy to a J2EE environment where you
    implement your Java as EJBs.
    We're still investigating these and other possible options.
    Perhaps you need to install your JAR archive into each of the relevant components (I'm not sure if this works.)
    Another possible alternative could be to identify where the JRE is installed on your XI server and deploy your classes in the lib extensions. (i.e. put your jar file in something like C:\j2sdk1.4.2_04\jre\lib\ext and restart the server) You should then be able to access these from anywhere, though I'm not sure what SAP would say about this solution.
    HTH,
    Patrick Parsons

  • Load Created Classes into the database

    Dear all,
    I successfully uploaded my created classes to the database then published them by creating a pl/sql procedures . But the execution of the procedure is returning:
    java.lang.UnsatisfiedLinkError: no csdkjni in java.library.path
    I've searched this error in metalink and it turned out that this is due to the unavailability of csdkjni lib file in the linux version of csdk (OCS 9i) . But i'm using OCS 10g ,so this shouldn't be my case.
    Could you please check this problem or give me some pointers on how to resolve this issue.
    Cheers!!

    Dear all,
    Maybe the description of my problem was a bit vague.
    So here is a list of things i've done :
    1- create a java class that creates an event .
    2- compiled and tested the class .
    3- used loadjava to load it into my database
    4- created a pl/sql procedure that calls this loaded class.
    5- call the procedure
    now at this point ,i hit the error : no csdkjni in java.library.path
    could you please give this a try in your environments and let me know!!

  • How to hot deploy java class?

    I write some java class and put them into the weblogic\class folder to
    replace the old java class files.
    When I run the program, the server still run the old java class.
    But when I restart the server, the server runs new java class.
    The server must restart, when I want to run new java class?
    thanks

    Does this work ??
    I was unable to achieve hot deployment using REDEPLOY file.
    Sheng Sheen <[email protected]> wrote in message
    news:[email protected]..
    You need to create a REDEPLOY file and touch the file.
    From the documentations:
    Dynamic Redeployment of Exploded Applications
    You can also dynamically redeploy applications or application components
    that have been deployed in exploded format. When an application has been
    deployed in exploded format, the Administration Server periodically looks
    for a file named REDEPLOY in the exploded application directory. If the
    timestamp on this file changes, the Administration Server redeploys the
    exploded directory.
    If you want to update files in an exploded application directory, do the
    following:
    a.. When you first deploy the exploded application, create an empty file
    named REDEPLOY in the directory where the exploded application resides.
    b.. To update the exploded application, copy the updated files over the
    existing files in that directory.
    c.. After copying the new files, touch the REDEPLOY file in the exploded
    directory to alter its timestamp.
    When the Administration Server detects the changed timestamp, it redeploys
    the contents of the exploded directory.
    "Alex" <[email protected]> wrote in message
    news:[email protected]..
    I write some java class and put them into the weblogic\class folder to
    replace the old java class files.
    When I run the program, the server still run the old java class.
    But when I restart the server, the server runs new java class.
    The server must restart, when I want to run new java class?
    thanks

  • Unable to compile the java class in the SQL PLUS

    Hi Team,
    I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
    But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
    What to do for this for your reference ,Attaching the java class file.
    “ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
    Was expecting one of:
    ----------------------Here is the Java class Code.....................
    create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
    as
    import java.math.BigDecimal;
    import java.util.zip.Deflater;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import java.sql.*;
    import java.io.*;
    public class XXVM_ZipFileUtil_Ela
    public static oracle.sql.BLOB getZipFile(
    oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
    int fileBufferSize, int zipFileBufferSize,
    boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
    throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
    String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
    String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
    String zipPathAndFileName = new String(
    new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
    new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
    byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
    try
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
    String[] fileNamesString = (String[])fileNames.getArray();
    BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
    zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
    for (int i = 0; i < fileNamesString.length; i++) {
    System.out.println(i);
    zipOut.putNextEntry(new ZipEntry(fileNamesString));
    InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
    int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
    zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
    zipOut.closeEntry();
    zipOut.close();
    byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
    FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
    int byteCount = zipIn.read(zipFileContents);
    zipIn.close();
    byte returnFileContents[] = new byte[byteCount];
    System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
    String returnFileContentsString = new String(returnFileContents);
    if (deleteZipFile)
    boolean deletedFile = (new File(zipPathAndFileName)).delete();
    oracle.sql.BLOB returnFileContentsBLOB = null;
    returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
    returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
    //OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
    OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
    tempBlobWriter.write(returnFileContents);
    tempBlobWriter.flush();
    tempBlobWriter.close();
    returnFileContentsBLOB.close();
    return returnFileContentsBLOB;
    catch (IllegalArgumentException ex) {
    ex.printStackTrace();
    throw ex;
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    throw ex;
    catch (IOException ex)
    ex.printStackTrace();
    throw ex;
    catch (java.sql.SQLException ex)
    ex.printStackTrace();
    throw ex;

    860411 wrote:
    Hi Team,
    I am unable to compile the java class in the SQL PLUS in dev1 and dev2. It is giving the following error.
    But the same class get Compiled in the Toad(Tool) without any error and working fine. Could someone help me
    What to do for this for your reference ,Attaching the java class file.
    “ORA-29536: badly formed source: Encountered "<EOF>" at line 1, column 28.
    Was expecting one of:
    I believe the error message is clear and self-explanatory.
    ----------------------Here is the Java class Code.....................
    create or replace and compile java source named "XXVM_ZipFileUtil_Ela"
    as
    import java.math.BigDecimal;
    import java.util.zip.Deflater;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import java.sql.*;
    import java.io.*;
    public class XXVM_ZipFileUtil_Ela
    public static oracle.sql.BLOB getZipFile(
    oracle.sql.CHAR zipFilePathCHAR, oracle.sql.CHAR zipFileNameCHAR,
    int fileBufferSize, int zipFileBufferSize,
    boolean deleteZipFile, java.sql.Array fileNames, java.sql.Array fileContents, java.sql.Array fileContentsLength)
    throws IllegalArgumentException, FileNotFoundException, IOException, java.sql.SQLException
    String zipFilePath = (zipFilePathCHAR == null) ? null : zipFilePathCHAR.stringValue();
    String zipFileName = (zipFileNameCHAR == null) ? null : zipFileNameCHAR.stringValue();
    String zipPathAndFileName = new String(
    new String(zipFilePath == null || zipFilePath == "" ? "/tmp/" : zipFilePath) +
    new String(zipFileName == null || zipFileName == "" ? System.currentTimeMillis() + ".zip" : zipFileName));
    byte[] buffer = new byte[fileBufferSize == 0 ? 100000000 : fileBufferSize];
    try
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    oracle.sql.CLOB[] fileContentsCLOB = (oracle.sql.CLOB[])fileContents.getArray();
    String[] fileNamesString = (String[])fileNames.getArray();
    BigDecimal[] fileContentsLengthNumber = (BigDecimal[])fileContentsLength.getArray();
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipPathAndFileName));
    zipOut.setLevel(Deflater.DEFAULT_COMPRESSION);
    for (int i = 0; i < fileNamesString.length; i++) {
    System.out.println(i);
    zipOut.putNextEntry(new ZipEntry(fileNamesString));
    InputStream asciiStream = fileContentsCLOB[i].getAsciiStream(1L);
    int asciiReadCount = asciiStream.read(buffer,0,fileContentsLengthNumber[i].intValue());
    zipOut.write(buffer, 0, fileContentsLengthNumber[i].intValue());
    zipOut.closeEntry();
    zipOut.close();
    byte zipFileContents[] = new byte[zipFileBufferSize == 0 ? 100000000 : zipFileBufferSize];
    FileInputStream zipIn = new FileInputStream(zipPathAndFileName);
    int byteCount = zipIn.read(zipFileContents);
    zipIn.close();
    byte returnFileContents[] = new byte[byteCount];
    System.arraycopy(zipFileContents,0,returnFileContents,0,byteCount);
    String returnFileContentsString = new String(returnFileContents);
    if (deleteZipFile)
    boolean deletedFile = (new File(zipPathAndFileName)).delete();
    oracle.sql.BLOB returnFileContentsBLOB = null;
    returnFileContentsBLOB = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
    returnFileContentsBLOB.open(BLOB.MODE_READWRITE);
    //OutputStream tempBlobWriter = returnFileContentsBLOB.getBinaryOutputStream();
    OutputStream tempBlobWriter = returnFileContentsBLOB.setBinaryStream(1);
    tempBlobWriter.write(returnFileContents);
    tempBlobWriter.flush();
    tempBlobWriter.close();
    returnFileContentsBLOB.close();
    return returnFileContentsBLOB;
    catch (IllegalArgumentException ex) {
    ex.printStackTrace();
    throw ex;
    catch (FileNotFoundException ex) {
    ex.printStackTrace();
    throw ex;
    catch (IOException ex)
    ex.printStackTrace();
    throw ex;
    catch (java.sql.SQLException ex)
    ex.printStackTrace();
    throw ex;
    The last two lines above should be
    /Srini

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • Manual Deployment of Java Class's to Database

    I was using JDeveloper, now my company has bought JBuilder 4.0, Can any one tell me how deploy my class's manually becuase JBuilder doesnt support deployment=(

    You will need to use the loadjava command line facility that comes with Oracle8i. JDeveloper's deployment feature just calls loadjava.
    You can find the doc for this in the Oracle8i Java Stored Procedures Developer's Guide, which is available on the Documentation pages of OTN.

  • Deploying java class that uses oraclexmlsql.jar

    Hi,
    I'm trying to deploy a java class that I wrote. It simply gets some data out of my oracle database as xml using the oraclexmlsql package. It works fine when I compile it within JDeveloper.
    When I try to deploy it JDeveloper gives out the following error:
    Errors in xmlquerydb:
    ORA-29521: refferenced name oracle/xml/sql/query/OracleXMLQuery could not be found
    loadjava: 1 errors
    I can't figure out why that happens. I have used other classes and deployed them as Java stored Procedure and they work fine.
    Thanks for help
    Andre

    I tried to load the oraclexmlsql.jar into the shema where I put my class. The classes from this jar were loaded but can not be compiled( apart from 3 ). I also tried loading my class into sys but I still can't compile it or the oraclexmlsql.jar classes.
    Is the xsu12.jar a collection of all the classes that are allready in Sys after the database install?
    I have noticed that on expanding the oraclexmlsql.jar file has a strange format and two classes classes are in the directory from which I expanded the jar. These two classes do not get a synonym on loading into the db. Could that have anything to do with it?
    Thanks for more help
    Andre

  • How to store java objects in the database

    Hi,
    I am trying to store HttpSession state across Application Servers. Basically I am trying to build a sort of application cluster server on my own. I thought the best way to do this was to periodically store the HttpSession object from an application server in a database.
    I created a table in Oracle 8i with a blob column. I use a PreparedStatement.setObject() method to store the HttpSession object in the database. My problem is, I don't know how to get the object back from the database.
    Since ResultSet.getBlob returns the Blob locator, I need to read the BinaryInputStream to get all my data back. This tells me that getBlob basically works only for things like files, and cannot be used for Java objects.
    Is there any way around this? Your input would be much appreciated.
    Regards,
    Somaiah.

    Thanks for the quick reply vramakanth.
    Do I have to use a type map if I do this? Also does such a type map exist for the HttpSession class?
    Thanks,
    Somaiah.

  • Java Class loaded in Database.

    hi
    I have loaded a Java class into Oracle 8.1.6 database. I have created a procedure (call spec) for calling a method in that class.
    It takes 3 parameters (Server ip address, From,To). Actually the purpose of the program is to take parameters and send mails
    The Java program uses JavaMail. I have loaded all classes required and the class shows status as valid. When I try to execute the method through a pl/sql procedure it gives the following error.
    ERROR at line 1:
    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(SANTOSH|PolicyTableProxy(SANTOSH))
    ORA-06512: at "SANTOSH.SENDMAIL", line 0
    ORA-06512: at line 2
    In Dbms_java package there is nothing called grant_permission .
    What may have gone wrong ???
    Thanks

    Maybe you should grant JAVASYSPRIV and JAVAUSERPRIV privilege to your db user
    first.
    Good luck!
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Santosh Nair ([email protected]):
    hi
    I have loaded a Java class into Oracle 8.1.6 database. I have created a procedure (call spec) for calling a method in that class.
    It takes 3 parameters (Server ip address, From,To). Actually the purpose of the program is to take parameters and send mails
    The Java program uses JavaMail. I have loaded all classes required and the class shows status as valid. When I try to execute the method through a pl/sql procedure it gives the following error.
    ERROR at line 1:
    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(SANTOSH|PolicyTableProxy(SANTOSH))
    ORA-06512: at "SANTOSH.SENDMAIL", line 0
    ORA-06512: at line 2
    In Dbms_java package there is nothing called grant_permission .
    What may have gone wrong ???
    Thanks<HR></BLOCKQUOTE>
    null

Maybe you are looking for