NoClassDefFound error oracle/sql/opaque
Hi There,
[Using Java 1.4.2, BEA WebLogic 8.1, Oracle 9i Db]
We're having a bit of trouble with the above error.
In our java code, we are referencing xdb.jar and odbc14.jar but when we try to create an XMLTYPE object from an OPAQUE object we receive the NoClassDefFound error.
Anyone with any ideas on how to get around this please?
Many thanks,
Neil
Hi,
I had the same problem...
Put the xsu12_817.jar or xsu12_816.jar (depends on RDBMS version) in your CLASSPATH instead of xsu12.jar. (you can find xsu12_817.jar and xsu12_816.jar files in Oracle XDK).
It should work.
Regards
Sash
Similar Messages
-
Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType
I have the following code written in java in a unix box and this is the error I get when compiling the code. I am not able to find which specific jar or class file I need, Kindly help.
XMLHelper.java:0: Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType.
^
1 error
OracleResultSet orst = .... some code to get data
orst.next();
//either of the following 2 lines give the same error
//XMLType dXml = XMLType.createXML(orst.getOPAQUE(1)) ;
XMLType dXml = (XMLType)orst.getObject(i);
xmlDoc = dXml.getDOM();
Please helpHello,
from the little information in your post i would say try to import oracle.sql.*, oracle.jdbc.* and oracle.xdb.*. Make sure your project can access the following libraries ojdbc14.jar and xdb.jar.
Regards, Marc -
NoClassDefFoundError: oracle/sql/OPAQUE
I've got some configuration problem with the XSU utility. It runs the getXML with all these settings fine. But when I run the putXML I get this result:
C:\Documents and Settings\kstclair>java OracleXML putXML -user "jandj/xprojxabc" -conn "jdbc:oracle:thin:@10.1.10.11:1521:UNIT1" -fileName "/testXML/transformed.goodusers.xml" user_data
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/OPAQUE
at OracleXML.Put_XML(OracleXML.java:444)
at OracleXML.ExecutePutXML(OracleXML.java:397)
at OracleXML.main(OracleXML.java:181)
Anybody seen this and know what it means? I've looked in most of the jars and can't even find this package sequence.Oops. I don't know if I missed in the doco, or if it's not there. If you use Oracle 8.1.7, then don't use the xsu12.jar. It will seem to work, and will even respond to getXML commands. But apparently you need to use the xsu12_817.jar instead. Most of the doco and examples are written for 9i users, so this point gets missed.
-
Abot oracle.sql.opaque exception
Wheen I run a program which is retreiving xmltype data from databse using a application then it works fine. But If I use jsp for same a deploy it on OC4jJ server it fgives exception at this line
xml = (XMLType)resultSet.getObject(1);
Excpeuin is ClassCasrtException: oracle.sql.OPAQUE
Please expalon. Methis is given below it works fine with application
public Vector doSelect (String keywords[]) throws Exception
//System.out.println("++++ Start of doSelect() method ++++");
// String SQLTEXT="SELECT extract(warehouse_spec,'/"+ str + "') as XMLDocument FROM WAREHOUSES";
/* select extract (value(t),'/VideoSubIndex')
* from mastersvideo x,TABLE (xmlsequence (
* extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t
* where existnode(value(t),'/VideoSubIndex[Transcription="So basically"]')=1
// String SQLTEXT="SELECT extract(x.vindex,'/VideoIndexes/VideoSubIndex/Transcription') as XMLDocument FROM mastersvideo x"+
// " where existsnode(x.vindex,'/VideoIndexes/VideoSubIndex[Transcription=\"So basically\"]')=1";
String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[Transcription=\"So basically\"]')=1";
// String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\"way\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
//keywords="sql";
//description="basically";
for(int i=0;i<keywords.length;i++)
System.out.println("KeyWords Received"+keywords);
String SQLTEXT=null;
if (keywords.length>0)
SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
" OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
for(int i=1;i<keywords.length;i++)
System.out.println("Value of i "+i+" And Value Here"+keywords[i]);
SQLTEXT+=" OR existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[i]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
" OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[i]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
// SQLTEXT+=
// Running Query
// String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
// " OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
//System.out.println(SQLTEXT);
OraclePreparedStatement sqlStatement = null;
//OracleResultSet resultSet = null;
ResultSet resultSet = null;
oracle.xdb.XMLType xml = null;
try
System.out.println("SQL := " + SQLTEXT);
sqlStatement = (OraclePreparedStatement) getConnection("scott","tiger").prepareStatement(SQLTEXT);
System.out.println("+++++ OraclePreparedStatement created +++++");
// resultSet = (OracleResultSet) sqlStatement.executeQuery();
resultSet = sqlStatement.executeQuery();
System.out.println("***** Query Executed *****");
// return resultSet;
Vector resVector=new Vector();
while(resultSet.next())
System.out.println("Hello Miss World");
xml = (XMLType)resultSet.getObject(1);
//System.out.println("Hello World");
resVector.add(xml);
// xml.get
System.out.println(xml.getStringVal());
//System.out.println("Hello Miss World");
System.out.println("Vector size is "+resVector.size());
return resVector;
catch(NullPointerException npe)
catch (SQLException SQLe)
if (sqlStatement != null)
sqlStatement.close();
throw SQLe;
/*if(resultSet!=null)
resultSet.close();
System.out.println("**** Resultset closed ****");
if(sqlStatement!=null)
sqlStatement.close();
System.out.println("**** Resultset closed ****");
System.out.println("### Returning Vector ###");
return null;
} // End of Function doSelect()I believe the 9.2 XDK requires the use of the 9.2 JDBC drivers.
In general, later versions of the JDBC driver will work with older versions of the database, but not vice versa. The 8.1.7 JDBC drivers won't necessarily work with a 9.2 database, but the 9.2 JDBC drivers will work with an 8.1.7 database.
Justin -
Oracle.sql.Opaque
Hi, I am using the JDBC drivers for Oracle 8.1.7 (classes12.zip ( 1,892 kB)) and when i am trying to generate xml using XDK (xdk_java_9_2_0_5_0.zip). If i use methods like insertXML or OracleXMLSave it throws me an exception: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/OPAQUE.
Then I use the driver for 9i (classes12.zip (1,143,559 bytes)) and it works fine, but I want to know what am I doing wrong, because my base document is Oracle 8i Application Developer’s Guide - XML. And I think these drivers have to work.
Another issue, thinking about performance and throughput, what driver should i use if my bd is 8.1.7, is it better to work with the specific version or the lastest?
ThanksI believe the 9.2 XDK requires the use of the 9.2 JDBC drivers.
In general, later versions of the JDBC driver will work with older versions of the database, but not vice versa. The 8.1.7 JDBC drivers won't necessarily work with a 9.2 database, but the 9.2 JDBC drivers will work with an 8.1.7 database.
Justin -
I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
Please Advice!
Thanks in advance
AnuPamaHi Anupama,
First of all I would be surprised if you would not like to use the connection pooling feature of weblogic (in which case you might not be needing the import the classes directly), and would like to open direct connections to your database. Anyways for doing that I would recommend you to check out the readme doc that ships
along with the jdbc oracle (classes12.zip etc). I am giving an excerpt over here:
These are a few simple things that you should do in your JDBC program:
1. Import the necessary JDBC classes in your programs that use JDBC.
For example:
import java.sql.*;
import java.math.*;
2. Register the Oracle driver before before calling other JDBC APIs.
(This is not needed if you are using the JDBC Server-side Internal
Driver because registration is done automatically in the server.)
To register the Oracle driver, make sure the following statement
is executed at least once in your Java session:
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
3. Open a connection to the database with the getConnection call.
Different connection URLs should be used for different JDBC
drivers. The following examples demonstrate the different URLs.
For the JDBC OCI8 Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:oci8:@<database>",
"scott", "tiger");
where <database> is either an entry in tnsnames.ora or a SQL*net
name-value pair.
For the JDBC Thin Driver, or Server-side Thin Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@<database>",
"scott", "tiger");
where <database> is either a string of the form
<host>:<port>:<sid> or a SQL*net name-value pair.
For the JDBC Server-side Internal Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:kprb:");
Note that the trailing ':' character is necessary. When you use
the Server-side Internal Driver, you always connect to the
database you are executing in. You can also do this:
Connection conn
= new oracle.jdbc.driver.OracleDriver().defaultConnection();
Hope this helps,
Thanks,
Anupama wrote:
I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
Please Advice!
Thanks in advance
AnuPama--
Apurb Kumar -
I need a oracle.sql.OPAQUE
Where are thi class. ???
It comes with the classes12.zip of Oracle client or database. The classes12.zip is present in the folder
<oracle_home>\jdbc\lib\classes12.zip
where <oracle_home> is the place where oracle is installed.
Regards,
Anupama
http://otn.oracle.com/sample_code/content.html -
Error oracle.sql.converter.CharacterConverters
Hi,
I am working with the latest version of jdk, BD XE and mapviewer r1
Thanks for your help.We migrated to Weblogic for iAS, never was anaswered.
-
Oracle SQL*PLUS has encountered a problem and needs to close. We are sorry
I have installed oracle10g release2(10.2.0.1.0) in my system
my porblem when i am trying to issue command
SQL> commit;
Commit complete.
SQL> cl scr;
then it is show below mentioned error
Oracle SQL*PLUS has encountered a problem and needs to close. We are sorry for the inconvenience.
Please can anybody help for me.
with regards,
srinivas.When working with mixed environments you should make sure the path environment variable is consistent with the executables you are currently running, and try not to mix them, i.e. if you are working with the sqlplus from 9i, make sure you execute the sqlplus.exe file from the 9i oracle home and temporarily by means of a batch file put your Oracle Home 9i executables prior to those of 10g , and the other way around, when executing from the 10g make sure all executables and paths are consistent. It should be easier since when installing oracle, oracle configures the PATH environment variable so it can be seen first in the path environment variable.
In your case you are using two compatible versions, but if the dll's get mixed there could be unexpected results.
~ Madrid
http://hrivera99.blogspot.com/ -
Power Query for Excel - Need Help with Oracle SQL Syntax
Hello everyone,
I am new to Power Query and am not able to figure this out. I am trying to pull in data into my Excel spreadsheet using a specific Oracle SQL query. While in query editor, how do I take the Oracle.Database function and add my SQL statement?
I already know what I want, I don't want it to download all the table names. According to the help page, I should be able to do this but it does not provide a syntax example
Also, I don't understand what "optional options as nullable record" means.
Below is what function and arguments the help page notes. How do I use this?
Oracle.Database(server as text, optional options as nullable record) as table
Any help is greatly appreciated.
Thank you,
JessicaWhen I try this, I get an error
DataSource.Error: Oracle: Sql.Database does not support the query option 'Query' with value '"Select * from Owner.View_Name"'. Details: null
I'm trying to download oracle data from a view into power query - Power Query navigator does not list th eviews from my source, it lists only the tables. When I try write sql statements, it throws me the above
error. This is what I tried
Oracle.Database("Source/Service",[Query="Select * from Owner.View_Name"])
Any ideas how to fix this? -
Oracle sql*plus has stopped working ?
During creation of database in oracle 11.1.0.6 using database configuration i am getting following error
oracle sql*plus has stopped working
any solution?Sorry ,we r getting the error while installation?
May be this can help
SQL*Plus won't start: Instant client 10.1 on Solaris 10 -
I recently started working on the Oracle SQL developer. I have 'select' privileges on the QA schema and when tried to execute proc in QA. It is giving the error as 'The file-based source <procedure Name> is not present in the database. Was it compiled?'
instead 'you do not have sufficient privileges to execute this procedure'. Did research on internet but with no luck.What configuration changes needed to be done to make it work.Guide me.Sounds like you do not have the correct privileges. What should have been granted to you by the QA user, or some other user with appropriate privileges, is...
grant EXECUTE on "QA"."<PROCEDURE_OF_INTEREST>" to "<YOUR_USERID>" ;
Note that a grant of execute on a procedure has nothing to do with grants of select on some or all of QA's tables and views.
So, as Vadim suggests, from your connection node in SQL Developer's Connections view, if you expand the Other Users node, then expand QA and look in the Procedures node, do you see the procedure of interest? If not, you cannot expect to be able to execute it from your userid's connection. And even if you do see it, you may have some other privilege that permits viewing but not executing, like...
The role SELECT_CATALOG_ROLE
The system privilege SELECT ANY DICTIONARY
And even if you do not see it there, then having certain other privileges granted to you could permit executing it in general, like...
The role EXECUTE_CATALOG_ROLE
The system privilege EXECUTE ANY PROCEDURE
Also, note that the 3.0 release is a bit dated nowadays. Upgrading to 4.0.3 production or even the 4.1 EA2 (early adopter) release will, in general, give you a better experience.
Best wishes,
Gary -
Error -While create a connection to Microsoft SQL Sever from Oracle SQL Dev
Dear All,
While I am trying to create a connection to Microsoft SQL Sever from Oracle SQL Developer. The following error: "Cannot connect to Microsoft SQL Server on localhost" has been occurred.
Can anyone please guide me to solve this..
Thanks in advance,
RiderHi,
Issue not supported in sharepoint on-premise team.
In addition, as this issue is related to Powerview, I suggest you create a new thread on for Powerview forum, more experts will assist you.
https://social.technet.microsoft.com/Forums/en-US/home?forum=powerview
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Error while calling data service: ClassCastException: oracle.sql.TIMESTAMP
I created a data service out of an Oracle datastore (table) which has a number of TIMESTAMP columns and deployed it in Axis2
When testing the Web Service in Designer, I get this error and can't find any solution:
com.sunopsis.wsinvocation.SnpsWSInvocationException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)
Caused by: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
... 8 more
Caused by:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
faultActor:
faultNode:
faultDetail:
{}stackTrace:java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.data.transform.impl.DataTransformerUtilDate2SqlTimestamp.from(DataTransformerUtilDate2SqlTimestamp.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerReverser.to(DataTransformerReverser.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerIfNullThenExceptionWrapper.to(DataTransformerIfNullThenExceptionWrapper.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerCombiner.to(DataTransformerCombiner.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.objectToXsd(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntity(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntityList(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeOMElement(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.DataServicesMessageReceiver.invokeBusinessLogic(DataServicesMessageReceiver.java)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:619)
oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)What database are you doing this with?
B -
Insert Blob column in the client errors ClassCastException: oracle.sql.BLOB
Hi,
When I try to insert and commit a Blob column(picture) I am getting the following exception.
Is there any jar I need to add or any other setup I need to do to accept the BLOB column in the olite client database.
500 Internal Server Error
javax.faces.FacesException: #{backing_XXPBWorkOrderResultsCreatePGBean.saveButton_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.sql.BLOB
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
Caused by: java.lang.ClassCastException: oracle.sql.BLOB
at oracle.lite.poljdbc.LiteEmbPreparedStmt.setVal(Unknown Source)
at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
at oracle.lite.poljdbc.POLJDBCPreparedStatement.setObject(Unknown Source)
at oracle.lite.web.JupPreparedStatement.setObject(Unknown Source)
at oracle.jbo.server.BaseSQLBuilderImpl.bindUpdateStatement(BaseSQLBuilderImpl.java:1765)
at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:7345)
With regareds,
Kali.
OSSI.Here are examples if inserting into a Blob from text, file, and retrieving a blob.
Insert into a Blob (Text)
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InsertBlob {
public static void main(String[] args) throws FileNotFoundException {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
String letterText = "some letter text";
long id = 100;
try {
DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
try {
con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
} catch (SQLException sqle) {
sqle.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
try {
stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, EMPTY_BLOB())");
stmt.setLong(1, id);
stmt.executeUpdate();
stmt = con.prepareStatement("SELECT BLOB_DATA FROM BLOB_TABLE WHERE BLOB_ID = ? FOR UPDATE");
stmt.setLong(1, id);
rs = stmt.executeQuery();
if (rs.next()) {
try {
oracle.lite.poljdbc.BLOB oliteBlob = null;
oliteBlob = ((oracle.lite.poljdbc.OracleResultSet) rs).getBLOB(1);
byte[] byteLetterText = letterText.getBytes();
oliteBlob.putBytes(1, byteLetterText);
con.commit();
} catch (ClassCastException e) {
e.printStackTrace();
} finally {
rs = null;
stmt = null;
con.rollback();
con = null;
} catch (SQLException e) {
e.printStackTrace();
}Insert Into a Blob (File)
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class InsertBlobFile {
public static void main(String[] args) throws FileNotFoundException {
Connection con = null;
PreparedStatement stmt = null;
long id = 200;
try {
DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
try {
con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
} catch (SQLException sqle) {
sqle.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
try {
stmt = con.prepareStatement("INSERT INTO BLOB_TABLE (BLOB_ID, BLOB_DATA) VALUES (?, ?)");
stmt.setLong(1, id);
File fBlob = new File ( "C:\\BLOB_TEST_FILE.TXT" );
FileInputStream is = new FileInputStream ( fBlob );
stmt.setBinaryStream (2, is, (int) fBlob.length() );
stmt.executeUpdate();
con.commit();
} catch (SQLException e) {
e.printStackTrace();
}Retrieve from Blob (Write to file)
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class RetrieveBlob {
final static int bBufLen = 32 * 1024;
final static String outFile = "C:\\BLOB_OUTPUT_FILE.TXT";
public static void main(String[] args) throws IOException {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
DriverManager.registerDriver((Driver)(Class.forName("oracle.lite.poljdbc.POLJDBCDriver").newInstance()));
try {
con = DriverManager.getConnection("jdbc:polite:polite", "system", "manager");
} catch (SQLException sqle) {
sqle.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
try {
stmt = con.prepareStatement("SELECT * FROM BLOB_TABLE");
rs = stmt.executeQuery();
while(rs.next()) {
int id = rs.getInt(1);
Blob value = rs.getBlob(2);
System.out.println(id + " | " + value);
writeBlobToFile(value);
} catch (SQLException e) {
e.printStackTrace();
public static long readFromBlob(Blob blob, OutputStream out)
throws SQLException, IOException {
InputStream in = blob.getBinaryStream();
int length = -1;
long read = 0;
byte[] buf = new byte[bBufLen];
while ((length = in.read(buf)) > 0) {
out.write(buf, 0, length);
read += length;
in.close();
return read;
public static long writeBlobToFile(Blob blob)
throws IOException, SQLException {
long wrote = 0;
OutputStream fwriter = new FileOutputStream(outFile);
wrote = readFromBlob(blob, fwriter);
fwriter.close();
return wrote;
}
Maybe you are looking for
-
ssince updating my IPad to IOS8 Safari does not work properly ie Marriott website it tells me no server is available yet Google works and other web search have the same problem when is Apple going to get fixes out soon I hope.Also why can't we contac
-
HTTP client code 405 reason ICM_HTTP_INTERNAL_ERROR
Hi Experts, Getting the below error in the RWB could any one look at this and help me out. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!-- Call Adapter --> - <SAP:Error xmlnsAP="_http://sap.com/xi/XI/Message/30" xmlnsOAP="_http://sch
-
I have an imac running 10.4.11 and want to install 10.5.8. How do I do that?
-
Price to repair liquid damaged MacBook Air (early 2014)
Anybody know what it will cost to repair a early 2014 13 inch MacBook Air with liquid damage? Is the repair a complete replacement of the innards? Is there an additional charge if the display is liquid damaged (not cracked)
-
How to burn an iMovie project to a DVD
I have created a movie using iMovie version 10.0 6. I have iDVD version 7.1.2. The only "sharing" in this version of iMovie are Theater, Email, iTunes, You Tube, Facebook, Vimeo, CNN Rept, File and Image. There is no export button, no media browse