Solved

Sending xml data retreived from oracle db from a java application into an other oracle db

Posted on 2004-09-14
109
996 Views
Last Modified: 2013-11-23
Hí,

I would like to retreive oracle data in an xml format and want to send that data to an other database. I have used XDK and was able to retreive data, but when im trying to send it, its giving me a runtime exception that the below statement is depracated << OracleXMLSave save = new OracleXMLSave(conn, tableName);>>.

So I want to know what is the other way available to send data?

So what does depracated mean in java, if it means taken away then what is the other new one that has been added or replaced?

All contributions will be appreciatted.

Thanks

My code looks like this......
-----------------------------------------------------------------------------------------------------
import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
import oracle.jdbc.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.dml.*;
import oracle.xml.sql.*;
import java.net.*;

public class testxml
{
    public static void main(String args[]) throws SQLException
    {
       
        Connection conn;
       
         
       
                         try
                                {
                              DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
                     
                        conn = DriverManager.getConnection ("");
                       
                             OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                              
                              //qry.setMaxRows(1);
                              
                            
                              String sx = qry.getXMLString();
                              String tableName = "employee";
                              
                              String fileName = (sx);
                              
                              
                              System.out.println(sx);
                              
   runtime exception >>>>> OracleXMLSave save = new OracleXMLSave(conn, tableName);
                            
                      >>>>  URL url = save.createURL(fileName);
                              int rowCount = save.insertXML(url);
                              System.out.println("successfull");
                              conn.close();
                            
                                         
                                }
                                
                                       catch (SQLException e)
                                         {
                                          System.out.println(e);
                                                  }
       
    }
}
0
Comment
Question by:vihar123
  • 40
  • 34
  • 30
  • +1
109 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 200 total points
Comment Utility
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
bottom line: it should no longer be used at all, as it might well cease to exist in the future.
0
 

Author Comment

by:vihar123
Comment Utility
>>bottom line: it should no longer be used at all, as it might well cease to exist in the future.

so what are the other possibilities through which, this could be achieved?
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 100 total points
Comment Utility
What do the docs say? JavaDocs should indicate which methods you should be using instead.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Your package documentation should propose what to use instead.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
I think it complains about this line:

>>>>>        URL url = save.createURL(fileName);

At http://www.oracle.com/technology/tech/xml/xdk/doc/beta/doc/java/javadoc/oracle/xml/sql/dml/OracleXMLSave.html I read:

java.net.URL createURL(java.lang.String fileName)
          Deprecated. since XSU2.0 -- use the static version of this method instead

0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
0
 
LVL 12

Assisted Solution

by:Giant2
Giant2 earned 200 total points
Comment Utility
instead of URL url = save.createURL(fileName);

use URL url=OracleXMLSave.getURL(fileName);
0
 

Author Comment

by:vihar123
Comment Utility
createURL(java.lang.String fileName)
          Deprecated. since XSU2.0 -- use the static version of this method instead

what does using the static version of this method mean, can somebody explain me :-)
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
It simply means that you can call it without a reference to the instance of the class, something like:

URL url = MyClass.myMethod();

instead of doing:

MyClass myClass = new MyClass();
URL url = myClass.myMethod();
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> what does using the static version of this method mean, can somebody explain me :-)
As Giant said before you asked:

replace
        URL url = save.createURL(fileName);
by
        URL url = OracleXMLSave.getURL(fileName);
0
 

Author Comment

by:vihar123
Comment Utility
its giving me the following exception at this line >>>>OracleXMLSave save = new OracleXMLSave(conn, tableName);

java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml.main(testxml.java:39)
Exception in thread "main"

0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
oracle/jdbc2/Clob is part of the driver. Are you sure this is in your classpath?
0
 

Author Comment

by:vihar123
Comment Utility
im not sure if its in my class path, shld I download this driver? where can i get this?
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
0
 

Author Comment

by:vihar123
Comment Utility
well im little bit confused, first i dont know what i shld download, is it classes12 or something else, and second things do i need to change my code
please clarify my doubts
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
It should be classes12. Open it up and check if it is there.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> do i need to change my code
If you did the change we suggested for tackling your initial deprecated problem, no.
For this java.lang.NoClassDefFoundError you don't need to change anything.
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
I see this:
http://sales.esicom.com/sales/oracle/java.816/a81354/oraint3.htm#1057115

What kind of environment are you using?
Oracle version? Oracle driver version? Java version?
0
 

Author Comment

by:vihar123
Comment Utility
ok i have read some docu, so i need classes111.zip - JDBC classes,

JDK Support
Oracle 8i Release 2 supports JDK 1.2 and JDK 1.1. As regards the former, the JDK 1.2 versions of the JDBC drivers are fully compliant with JDBC 2.0. The implementation is by means of the interfaces in the standard java.sql package included in the file classes12.zip. On the Oracle side, these interfaces are implemented as appropriate by classes in the oracle.sql and oracle.jdbc.driver packages. The files java.sql.* and oracle.sql.* need to be imported for _JDK 1.2.
As regards JDK 1.1.x, the file classes111.zip is needed. The implementation of JDBC2.0 functionality is by means of the package oracle.jdbc2 still included in classes111.zip. Features such as objects, object references, arrays, and LOBS can be used by importing this package. The files java.sql.*, oracle.jdbc2.*, and oracle.sql.* need to be imported for JDK 1.1.x.
The package java.sql.* comes with JDK; the packages oracle.sql.*, oracle.jdbc.driver, and oracle.jdbc2 come with Oracle's drivers.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
Can you post us your classpath?
0
 

Author Comment

by:vihar123
Comment Utility
>>>What kind of environment are you using?
Oracle version? Oracle driver version? Java version?

I didnt understand your question

>>>Can you post us your classpath?

c:\j2sdk1.4.2_03\jre\lib\ext
0
 

Author Comment

by:vihar123
Comment Utility
when I am going to this link to download, its showing as page not found......is there any other site or public domain where i can download this classes111.zip


http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html

0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
You shouldn't need classes111.zip, classes12.zip should be enough.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
If you don't want to mess with the class path,
then just place the downloaded jar file in your c:\j2sdk1.4.2_03\jre\lib\ext directory
0
 

Author Comment

by:vihar123
Comment Utility
>>>You shouldn't need classes111.zip, classes12.zip should be enough.

should i set some path or somethings with the classes12

my classes12.jar is in the ext already
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
why you do not use:
ojdbc14.jar
instead of
classes12.jar ??
0
 

Author Comment

by:vihar123
Comment Utility
is there any othe site where i can download this classes111.zip?
0
 

Author Comment

by:vihar123
Comment Utility
could anybody answer, its a little bit urgent.

thanks
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> is there any othe site where i can download this classes111.zip?
Sorry, can't find one :(

0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
Sorry for the late, I was out of office.

The site of Oracle is the "standard" for download the JDBC driver
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
classes111.zip.
So You are using Oracle 9.2 and java1 environment.
This is the answer to my previous post:
>>>What kind of environment are you using? Oracle version? Oracle driver version? Java version?

And now.
Do you have a particular requirement for using this kind of java environment?
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>>The site of Oracle is the "standard" for download the JDBC driver
Right, but it gives "page not found" when clicking the classes111.zip file...
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
please vihar123, answer to my last question.

zzynx, I allready see it gives "page not found". I only say that it's really difficult to find other site to download this api.
0
 

Author Comment

by:vihar123
Comment Utility
ok i found it and put it in the ext folder, and now its giving me a new exception "java.sql.SQLException: Exceding key size"

i dont have any idea about this error

any contributions
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
you are doing a query using keyfield of different size. In particular from bigger to little.
0
 

Author Comment

by:vihar123
Comment Utility
>>>Do you have a particular requirement for using this kind of java environment?

well my requirement is extracting oracle data in xml format and send it into an other database.
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
>>>Do you have a particular requirement for using this kind of java environment?
>well my requirement is extracting oracle data in xml format and send it into an other database.
I speak about JAVA environment. (version java 1.1 and not java 1.4 for example).


for the last exception, check the field where you are inserting data. Maybe they are little short.
0
 

Author Comment

by:vihar123
Comment Utility
>>>you are doing a query using keyfield of different size. In particular from bigger to little.

how should i solve this problem? im putting all my code for better idea.....

actually in my code, im retreiving a table in xml format, and then putting it into a file and then sending it to database.

---------------

import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
import oracle.jdbc.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.dml.*;
import oracle.xml.sql.*;
import java.net.*;
import oracle.xml.parser.v2.*;
import java.io.*;
import oracle.xml.sql.dml.OracleXMLSave;



public class testxml
{
    public static void main(String args[]) throws SQLException
    {
       
        Connection conn;
       
         
       
                         try
                                {
                              DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
                     
                        conn = DriverManager.getConnection ("");
                       
                              OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                              String sx = qry.getXMLString();
                              System.out.println(sx);
                              
                              //table into whichi, the data would be inserted//
                              String tableName = "employee";
                              String fileName = "emps.xml";
                              
                              sx = "emps.xml";
                              
                              //inserting data from xml into database table//
                              
                              OracleXMLSave save = new OracleXMLSave(conn, tableName);
                              URL url=OracleXMLSave.getURL(fileName);
                                                         
                              System.out.println("success");
                              conn.close();
                              
                                }
                                
                                       catch (SQLException e)
                                         {
                                          System.out.println(e);
                                                  }
       
    }
}
0
 

Author Comment

by:vihar123
Comment Utility
>>>I speak about JAVA environment. (version java 1.1 and not java 1.4 for example).

ok sorry i misunderstood, well im using 1.4

an other question is, should i be having the table first being created in my database? cause in the documentation i read it creates by its own.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> now its giving me a new exception "java.sql.SQLException: Exceding key size"
Complete stack dump please... At what line is it thrown?
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
>im retreiving a table in xml format
but not the structure.
If you try to save a NVARCHAR2 size 100 in NVARCHAR2 size 10, I believe there could be an error.

The thing you must be sure is that the data type and size where you are inserting are compatible with what you read.
You must check the structures.
0
 

Author Comment

by:vihar123
Comment Utility
>>>Complete stack dump please... At what line is it thrown?

no line is shown, a runtime exception

>>>The thing you must be sure is that the data type and size where you are inserting are compatible with what you read.
You must check the structures.

so that means i shld have the table created in db where i want to send data


0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
>im using 1.4

For this version is present this jar on the OracleSite (when it'll go up)
ojdbc14.jar


>should i be having the table first being created in my database? cause in the documentation i read it creates by its own.

I believe it execute a dump only for the query of data and not about the structure.
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
See here:
http://www.comp.hkbu.edu.hk/docs/o/dl/web/B10926_01/java_xsu.htm#1005249
It says:
"getXMLString()
Transforms the object-relational data, specified in the constructor, into a XML document. "

I doensn't speak about structure, but about data.
0
 

Author Comment

by:vihar123
Comment Utility
is there something wrong with my code, how should i solve this problem of exceeding key size?????

well its retreiving the data properly and i have made the inserting table with same specifications, still its giving me the same exception.

can somebody provide some ideas
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
Now I see your code:
It's little wrong. You do not save in the file what you read from the db.
Try this:
      public static void main(String args[]) throws SQLException {
            Connection conn;
            try {
                  OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                  String sx = qry.getXMLString();
                  System.out.println(sx);
                  //              table into whichi, the data would be inserted//
                  String tableName = "employee";
                  String fileName = "emps.xml";
                  try {
                        //writing to file
                        BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
                        out.write(sx);
                        out.close();
                  } catch (IOException e) {System.out.println(e);}
                  //inserting data from xml into database table//
                  OracleXMLSave save = new OracleXMLSave(conn, tableName);
                  URL url = OracleXMLSave.getURL(fileName);

                  System.out.println("success");
                  conn.close();
            } catch (SQLException e) {
                  System.out.println(e);
            }
      }
0
 

Author Comment

by:vihar123
Comment Utility
thanks but even after trying this its giving me the same error "exceeding key size"

OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                              String sx = qry.getXMLString();
                              System.out.println(sx);
                              
                              //table into whichi, the data would be inserted//
                              String tableName = "employee";
                              String fileName = "emps.xml";
                              
                              //inserting data from xml into database table//
                              try {
                          //writing to file
                    BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
                    out.write(sx);
                                           
                    out.close();
                    }
                                     catch (IOException e) {System.out.println(e);}

                              OracleXMLSave save = new OracleXMLSave(conn, tableName);
                              URL url=OracleXMLSave.getURL(fileName);
                              int rowCount = save.insertXML(url);
                              
                                                         
                              System.out.println("success");
                              conn.close();
                              
                                }
                                
                                       catch (SQLException e)
                                         {
                                          System.out.println(e);
                                                  }
       
    }
}
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
What is the full error message?
Normally is ORA-____ message
What is your?
0
 

Author Comment

by:vihar123
Comment Utility
java.sql.SQLException: Exceding key size

its just giving this output after running, thats all
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
ORA-17413
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
try to put a System.out here:
               OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
               System.out.println("Hi I'm here!!!");//-------------------------insert this line
               String sx = qry.getXMLString();
               System.out.println(sx);
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:vihar123
Comment Utility
>>>System.out.println("Hi I'm here!!!");//-------------------------insert this line

its giving the same error, so actually its not retreiving......
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> Complete stack dump please

Could you add the following line in the catch block to procuce more error info:

 } catch (SQLException e) {
        e.printStackTrace();          // <<<<<<<<< add this line
        System.out.println(e);
 }

0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> its giving the same error, so actually its not retreiving......
Wrong conclusion.
Add the line I suggested and tell us what it is printing
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
and tell us the full dump it gave, like:
blablabla.....
...
.
Error

thanks.
0
 

Author Comment

by:vihar123
Comment Utility
well the problem lies with classes111, when i deleted it, its no more giving the error, atleast retreiving is going fine.

but for inserting its asking for classes111

strange exceptions****
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
>strange exceptions****
What exceptions?!?!? Post them, please.

After this try to replace the place in which you insert into db with the following:

OracleXMLSave save = new OracleXMLSave(conn, tableName);
InputStream is = new FileInputStream(fileName);
int rowCount = save.insertXML(is);

0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Could you tell us the output result of printStackTrace()?
0
 

Author Comment

by:vihar123
Comment Utility
>>>After this try to replace the place in which you insert into db with the following:


>>> What exceptions?!?!?

java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml2.main(testxml2.java:39)
Exception in thread "main"


---------------


OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                              System.out.println("Hi I'm here!!!");
                              String sx = qry.getXMLString();
                              //System.out.println(sx);
                                
                                
                                 String tableName = "employee";
                              String fileName = "emps.xml";
                              
                                  OracleXMLSave save = new OracleXMLSave(conn, tableName);
                                    
                                    try {
                          //writing to file
                          InputStream is = new FileInputStream(fileName);
                    BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
                    out.write(sx);
                 //System.out.println("hi");
                     int rowCount = save.insertXML(is);      
                    out.close();
                    }
                                     catch (IOException e) {System.out.println(e);}

                                    
                                                 
                                           
                   
                    }
                                                                     catch (SQLException e)
                                         {
                                          System.out.println(e);
                                                  }
       
    }
}
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Please, could you tell us the output result of ******printStackTrace()******?
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
are you downloaded and installed the correct Oracle-XDK ?
I seems your XKD installation is not done correctly.
the jar file containing your Clob class could be part of XDK environment.
Try to reinstall it.

See here:
http://www.oracle.com/technology/tech/xml/xdk/doc/production/java/index.html
0
 

Author Comment

by:vihar123
Comment Utility
>>>Please, could you tell us the output result of ******printStackTrace()******?

well i tried this, but its now showing anything except this error

Hi I'm here!!!
hi
java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml2.main(testxml2.java:39)
Exception in thread "main"
 
-----------------

OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");
                              System.out.println("Hi I'm here!!!");
                              String sx = qry.getXMLString();
                              System.out.println("hi");
                                
                                
                              String tableName = "employee";
                              String fileName = "emps.xml";
                              try {
                                  OracleXMLSave save = new OracleXMLSave(conn, tableName);
                                  InputStream is = new FileInputStream(fileName);
                                          int rowCount = save.insertXML(is);
                                          is.close();
                    }
                                     catch (IOException e) {System.out.println(e);
                                      }

                                                                   
                                                                  }
                             catch (SQLException e)
                                         {
                                          e.printStackTrace();      
                                      
                                          System.out.println(e);
                                          
                                                  }
       
    }
}      
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
It seems to me that the XDK doesn't correctly installed.

In XDK there is a jar with oracle/jdbc2/clob (I don't remember where, I used many times ago and now the Oracle site is partially down)
0
 

Author Comment

by:vihar123
Comment Utility
ok ill try to re install it and try again. the right way of installing i think is to extract and put in the ext folder?
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
yes. In the ext folder of the jdk/jre you use to run.
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
to be sure you use the correct XDK you can extract all in a specific folder and then add this folder (and all the jar/zip file) to the classapth.

java -classapth..........
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
the ext directory is only for JRE not for JDK. So I believe (to do not make a mistake) extract all in a specific folder and then add this folder (and all the jar/zip file) to the classapth.

Hope this help you.
Bye, Giant.
0
 

Author Comment

by:vihar123
Comment Utility
>>>the ext directory is only for JRE not for JDK. So I believe (to do not make a mistake) extract all in a specific folder and then add this folder (and all the jar/zip file) to the classapth.

so, does that means I shouldnt add it in the ext folder "c:\j2sdk1.4.2_03\jre\lib\ext" ???????????????
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
are you using JRE or JDK for run?
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> so, does that means I shouldnt add it in the ext folder "c:\j2sdk1.4.2_03\jre\lib\ext" ???????????????
No. Adding it to the c:\j2sdk1.4.2_03\jre\lib\ext folder is OK.
It's just an alternative to setting the class path.

>>are you using JRE or JDK for run?
If you run it via the JRE of course. That is: if you don't run it from within your IDE (if you're using one)
0
 

Author Comment

by:vihar123
Comment Utility
>>>are you using JRE or JDK for run?

could be stupid question, but can you tell me how to know this if I am running jdk or jre
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
from the code you post I see it's an application (not applet), so could you post the path you use?
I believe when you run this application you do:
java testxml

if we see the path you use we can know if you are using JDK or JRE.
0
 

Author Comment

by:vihar123
Comment Utility
im using a tool called java beginner, and it gives something like this.




java -classpath I:\Gotla\java;C:\j2sdk1.4.2_03\jre\lib\charsets.jar;C:\j2sdk1.4.2_03\jre\lib\classes12.jar;C:\j2sdk1.4.2_03\jre\lib\jce.jar;C:\j2sdk1.4.2_03\jre\lib\jsse.jar;C:\j2sdk1.4.2_03\jre\lib\plugin.jar;C:\j2sdk1.4.2_03\jre\lib\rt.jar;C:\j2sdk1.4.2_03\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_03\jre\lib\ext\bin;C:\j2sdk1.4.2_03\jre\lib\ext\classes12.jar;C:\j2sdk1.4.2_03\jre\lib\ext\classgen.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dms2Server.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_03\jre\lib\ext\jdev-rt;C:\j2sdk1.4.2_03\jre\lib\ext\jdev-rt.zip;C:\j2sdk1.4.2_03\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_03\jre\lib\ext\lib;C:\j2sdk1.4.2_03\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_03\jre\lib\ext\oraclexsql.jar;C:\j2sdk1.4.2_03\jre\lib\ext\samples.jar;C:\j2sdk1.4.2_03\jre\lib\ext\servlet.jar;C:\j2sdk1.4.2_03\jre\lib\ext\soap.jar;C:\j2sdk1.4.2_03\jre\lib\ext\sunjce_provider.jar;C:\j2sdk1.4.2_03\jre\lib\ext\transx;C:\j2sdk1.4.2_03\jre\lib\ext\transx.zip;C:\j2sdk1.4.2_03\jre\lib\ext\xdb.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xdk;C:\j2sdk1.4.2_03\jre\lib\ext\xmlcomp.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlcomp2.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlmesg.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlparserv2.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xschema.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsqlserializers.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111_816.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111_817.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12_816.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12_817.jar;C:\Progra~1\JavaBeginner\samples; testxml2
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
java beginner? I don't know it.
But if you open the command-prompt, go to your develop directory and type java testxml2 what is the result?
0
 

Author Comment

by:vihar123
Comment Utility
>>But if you open the command-prompt, go to your develop directory and type java testxml2 what is the result?

result:-

I:\per\java>java testxml2
Hi I'm here!!!
hi
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml2.main(testxml2.java:39)
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
do this (from the prompt):
echo %PATH%
0
 

Author Comment

by:vihar123
Comment Utility
>>>echo %PATH%

C:\j2sdk1.4.2_03\bin;C:\orant\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\W
bem;C:\Program Files\perl\bin;C:\Program Files\it_sec\iT_SEC_Shared
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
ok.
now do this:
java - version

and tell me where you have installed your XDK (and the jar file contained in it)
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
You can let your own program print out the version and the class path as follows:

System.out.println( "Java version =" + System.getProperty("java.version") );
System.out.println( "Class path = " + System.getProperty("java.class.path") );

>>tell me where you have installed your XDK (and the jar file contained in it)
Thought he told us:
      >> >>the right way of installing i think is to extract and put in the ext folder?
      >> yes. In the ext folder of the jdk/jre you use to run.
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
The thing I try to guide to you is the following:
java -classpath <here all the jar you have in the XDK separated by ;> testxml2

if the java is not the correct I'll guide you to do:
C:\j2sdk1.4.2_03\bin\java -classpath <here all the jar you have in the XDK separated by ;> testxm


zzynx, I do not understand what you are saying.
0
 

Author Comment

by:vihar123
Comment Utility
Java version =1.4.2_03

C:\j2sdk1.4.2_03\jre\lib\ext\xdk
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> zzynx, I do not understand what you are saying.
If you let him add the lines

      >>System.out.println( "Java version =" + System.getProperty("java.version") );
      >>System.out.println( "Class path = " + System.getProperty("java.class.path") );

to his code (e.g. at the beginning instead of the "Hi I'm there"),
then no matter how or from where it is run, it will give you the version and class path
that is used at the moment of running the program.

vihar, I think you should place all XDK jar files in
        C:\j2sdk1.4.2_03\jre\lib\ext
not in
        C:\j2sdk1.4.2_03\jre\lib\ext\xdk
0
 

Author Comment

by:vihar123
Comment Utility
>>>   C:\j2sdk1.4.2_03\jre\lib\ext

they are already placed
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>>they are already placed
Sure?
Doesn't that conflict with what you are saying here:
     >>>> tell me where you have installed your XDK (and the jar file contained in it)
     >>C:\j2sdk1.4.2_03\jre\lib\ext\xdk
0
 

Author Comment

by:vihar123
Comment Utility
Doesn't that conflict with what you are saying here:
     >>>> tell me where you have installed your XDK (and the jar file contained in it)
     >>C:\j2sdk1.4.2_03\jre\lib\ext\xdk

all those jar files that where in lib folder i cut and copied to the ext folder........
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
the Oracle JDBC driver you must use is:
ojdbc14.jar (and not classes111.zip)
available on Oracle site (today goes)
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> the Oracle JDBC driver you must use is:
>> ojdbc14.jar (and not classes111.zip)

Could be right. So try:
- delete (or move again) all jar files that you copied to C:\j2sdk1.4.2_03\jre\lib\ext
- place the ojdbc14.jar in C:\j2sdk1.4.2_03\jre\lib\ext
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
>- delete (or move again) all jar files that you copied to C:\j2sdk1.4.2_03\jre\lib\ext
Not really right.
In the classpath must be present the XDK jar and jdbc-odbc jar.
I say "must be ojdbc14.jar" because the jdbc-odbc suggested in the Oracle site is this and not classes111.zip
I try to download both and I see that only classes111.zip contains oracle/jdbc2/... So I suppose that you are using this last (wrong) jar.
0
 

Author Comment

by:vihar123
Comment Utility
Hi,
i tried my best to get this ojdbc14.jar, but couldnt get, i think the official site server is dowm, does anybody have it in some public domain......can somebody help me to get this :-)
thanks
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
No, the Oracle site is Up! I can now download it from the Oracle Site:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc9201.html
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> does anybody have it in some public domain
http://www3.dropload.com/redeem.php?t=588b1437e3739eac6f7eea88adc08980
0
 

Author Comment

by:vihar123
Comment Utility
>> does anybody have it in some public domain
http://www3.dropload.com/redeem.php?t=588b1437e3739eac6f7eea88adc08980

>>>>>>>>>>>>>>>>>>its showing this message

File Pickup
The file "ojdbc14.jar" was picked up on 2004-09-16 03:50:09. Please contact the person who sent you this link if there's been some sort of mistake.

0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Seems like someone else downloaded it already.
Another try: http://www.dropload.com/redeem.php?t=350f477b360957e16f568de959e0371a
0
 

Author Comment

by:vihar123
Comment Utility

thanks zzynx, i could download, hope it works now :-)
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
I really hope it for you...
0
 

Author Comment

by:vihar123
Comment Utility
I place the jar file in ext, C:\j2sdk1.4.2_03\jre\lib\ext\ojdbc14.jar ----but its still giving the same exception

java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml2.main(testxml2.java:42)
Exception in thread "main"
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Damn, what an obstinate problem!

Could you add

      System.out.println( "Java version =" + System.getProperty("java.version") );
      System.out.println( "Class path = " + System.getProperty("java.class.path") );

after

     OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp1");

and copy/paste the resulting output once again?
0
 

Author Comment

by:vihar123
Comment Utility
even i feel the same, this error has been troubling me since yesterday....
-----------------------------

Java version =1.4.2_03
Class path = I:\Gotla\java;C:\j2sdk1.4.2_03\jre\lib\charsets.jar;C:\j2sdk1.4.2_03\jre\lib\classes12.jar;C:\j2sdk1.4.2_03\jre\lib\jce.jar;C:\j2sdk1.4.2_03\jre\lib\jsse.jar;C:\j2sdk1.4.2_03\jre\lib\plugin.jar;C:\j2sdk1.4.2_03\jre\lib\rt.jar;C:\j2sdk1.4.2_03\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_03\jre\lib\ext\bin;C:\j2sdk1.4.2_03\jre\lib\ext\charsets.jar;C:\j2sdk1.4.2_03\jre\lib\ext\classgen.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dms2Server.jar;C:\j2sdk1.4.2_03\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.2_03\jre\lib\ext\jce.jar;C:\j2sdk1.4.2_03\jre\lib\ext\jdev-rt;C:\j2sdk1.4.2_03\jre\lib\ext\jdev-rt.zip;C:\j2sdk1.4.2_03\jre\lib\ext\jsse.jar;C:\j2sdk1.4.2_03\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.2_03\jre\lib\ext\lib;C:\j2sdk1.4.2_03\jre\lib\ext\localedata.jar;C:\j2sdk1.4.2_03\jre\lib\ext\ojdbc14.jar;C:\j2sdk1.4.2_03\jre\lib\ext\oraclexsql.jar;C:\j2sdk1.4.2_03\jre\lib\ext\plugin.jar;C:\j2sdk1.4.2_03\jre\lib\ext\rt.jar;C:\j2sdk1.4.2_03\jre\lib\ext\samples.jar;C:\j2sdk1.4.2_03\jre\lib\ext\servlet.jar;C:\j2sdk1.4.2_03\jre\lib\ext\soap.jar;C:\j2sdk1.4.2_03\jre\lib\ext\sunjce_provider.jar;C:\j2sdk1.4.2_03\jre\lib\ext\sunrsasign.jar;C:\j2sdk1.4.2_03\jre\lib\ext\transx;C:\j2sdk1.4.2_03\jre\lib\ext\transx.zip;C:\j2sdk1.4.2_03\jre\lib\ext\xdb.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xdk;C:\j2sdk1.4.2_03\jre\lib\ext\xmlcomp.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlcomp2.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlmesg.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xmlparserv2.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xschema.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsqlserializers.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111_816.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu111_817.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12_816.jar;C:\j2sdk1.4.2_03\jre\lib\ext\xsu12_817.jar;C:\Progra~1\JavaBeginner\samples;
Hi I'm here!!!
hi
java.lang.NoClassDefFoundError: oracle/jdbc2/Clob
        at testxml2.main(testxml2.java:43)
Exception in thread "main"
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Almost out of ideas... :°(

I think your small app incorrectly uses some older classes that shouldn't be there anymore.
E.g. I see  xsu111.jar, xsu111_816.jar, xsu111_817.jar, xsu12.jar, xsu12_816.jar and xsu12_817.jar
      Sure *all* are needed?

I think in that direction. Mere intuition though
0
 

Author Comment

by:vihar123
Comment Utility
>>>Sure *all* are needed?

i tried to play around taking them, one by one and all at a time, programm is not identifying some packages like oracle.xml.sql.

so shld i post this as a new question to get more contributions or it doesnt make difference?
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
Last question.
Do you use OCI or Thin to connect?
If you use OCI you must download even the appropriate set of dll.

From all the post I see that jdbc2 is used to do all and these classes are present only in classes111.jar, but this is for Java1 and you use Java2.
I think some other things must be installed (an XDK recent, for example). I seed the code and it's not uncorrect. It's the code suggested in the newgroup and in the example.
0
 

Author Comment

by:vihar123
Comment Utility
im using thin
conn = DriverManager.getConnection ("jdbc:oracle:thin:----------------)
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
>> shld i post this as a new question to get more contributions or it doesnt make difference?
Closing this Q and posting it as a new question would certainly attract the attention of more experts
than just the two of us.
0
 

Author Comment

by:vihar123
Comment Utility
ok i think ill ask it as a new question

thanks for everything.
0
 
LVL 37

Expert Comment

by:zzynx
Comment Utility
Thanks for accepting,
but I think the solution of your first problem really deserved an A grade
0
 
LVL 12

Expert Comment

by:Giant2
Comment Utility
:)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now