Reading BLOB
Hi,
I successfully inserted a file into a BOLB column in oracle database using java program(prepared statement).
I wanted to read that blob column and convert that as a file object.
Thanks in advance.
Have a look at the sample code here
http://technet.oracle.com/doc/java.815/a64685/oraext4.htm#1043272
Similar Messages
-
Problem with Pro*C reading BLOB field from Oracle 10g
Hello Experts,
We have a Pro*c application which is reading the BLOB data fields (a PNG image file) from Oracle data base. It holds the BLOB fields returned from the SQL query into a Unsigned Char structure in Pro*C. The program used work fine on AIX 32 – bit 4.3 and Oracle 8.1 environment.
Recently, we have upgraded the environment to AIX 64-bit 5.3 and Oracle 10g.Since after the Pro*c program has problem in reading the Blob filed.
Below is the query we are trying to execute –
EXEC SQL
SELECT
signtre_image, image_file_name_ext
INTO
:msipLocalImage INDICATOR :msipLocalImage_i,
:file_name_ext INDICATOR :file_name_ext_i
FROM
dcs_sign
WHERE
signtre_nbr = :signtre_nbr;
Here signtre_image is the BLOB fields and msipLocalImage is a Pro*C structure define as below –
typedef struct tagSignImage
long len; /* Image length */
unsigned char img[1]; /* Pointer to first byte. */
} MOTS_SIGN_IMAGE;
The quesry does not give any error or exception message in the Pro*C , program just stops at the point of executing the quesry..When we run the query commenting the BLOB filed it works fine. Also, the query runs good when we run it in the Oracle editor.
There seems to be problem with the way we are reading the BLOB field in the new Oracle 10g enviromet.
Does any body have any idea what’s wrong with this query? We really need it to work.
Any Help will be greatly appreciated.
Thanks,
- Rajan YadavThanks a ton for your response.
We made the necessary changes as suggested by you.This time we got another flavour of error - SQL Error Code - Inconsistent error while reading BLOB.
Another thing we noticed is that the data field which we are trying to read is defined as LONG RAW instead of a BLOB in data base.
Are these two things related in any sense or is there anything else which is causing the error.
Once again Thanks for your help.
- Rajan Yadav -
Reading BLOB from SQL Server 2005 using DB Link from Oracle 10g
Hi All,
I am trying to read a table's data from SQL Server 2005 using ODBC DB Link created in Oracle 10g (10.2.0.3/4) database. I am not using oracle gateway.
I am able read all data except for the BLOB data from SQL server 2005. It gives error given below when I try to execute query SELECT * from T_TRANSACTION_DATA@sdeslink inside a stored procedure:
ORA-22992: cannot use LOB locators selected from remote tables
Kindly help how to read BLOB from SQL server 2005 inside Oracle 10g.
Best Regards!
IrfanIrfan,
If you can read the blob data using 10.2 HSODBC then there should be no problem using the 11g gateway.
I recommend you download the latest version which is 11.2.0.3 available from My oracle Support as -
Patch 10404530: 11.2.0.3.0 PATCH SET FOR ORACLE DATABASE SERVER
This is a full version and does not need a previous version to have bene installed. When installing it needs to be in a completlely separate ORACLE_HOME from the existing 11.2 install.
For the Ora-22992 problem have a look at this note in My Oracle Support -
Ora-22992 has a workaround in 10gR2 (Doc ID 436707.1)
Regards,
Mike -
Oracle 9i reading BLOB performance issues
Windows XP Pro SP2
JDK 1.5.0_05
Oracle 9i
Oracle Thin Driver for JDK 1.4 v.10.2.0.1.0
DBCP v.1.2.1
Spring v1.2.7 (I am using the JDBC template for convenience)
I have run into serious performance issues reading BLOBs from Oracle using oracle's JDBC thin driver. I am not sure if it a constraint/mis-configuration with oracle or a JDBC problem.
I am hoping that someone has some experience accessing multi-MB BLOBs under heavy volume.
We are considering using Oracle 8 or 9 as a document repository. It will end up storing hundreds of thousands of PDFs that can be as large as 30 MBs. We don't have access to Oracle 10.
TESTS
I am running tests against Oracle 8 and 9 to simulate single and multi-threaded document access. Out goal is to get a sense of KBps throughput and BLOB data access contention.
DATA
There is a single test table with 100 rows. Each row has a PK id and a BLOB field. The blobs range in size from a few dozen KB to 12MB. They represent a valid sample of production data. The total data size is approx. 121 MBs.
Single Threaded Test
The test selects a single blob object at a time and then reads the contents of the blob's binary input stream in 2 KB chunks. At the end of the test, it will have accessed all 100 blobs and streamed all 121 MBs. The test harness is JUnit.
8i Results: On 8i it starts and terminates successfully on a steady and reliable basis. The throughput hovers around 4.8 MBps.
9i Results: Similar reliability to 8i. The throughput is about 30% better.
Multi-Threaded Test
The multi-threaded test uses the same "blob reader" functionality used in the single threaded test. However, it spawns 8 threads each running a separate "blob reader".
8i Results: The tests successfully complete on a reliable basis. The aggregate throughput of all 8 threads is a bit more than 4.8 MBps.
9i Results: Erratic. The tests were highly erratic on 9i. Threads would intermittently lock when accessing a BLOB's output stream. Sometimes they lock accessing data from the same row, othertimes it is distinct rows. The number and the timing of the thread "locks" is indeterminate. When the test completed successfully the aggregate throughput of the 8 threads was approx. 5.4 MBps.
I would be more than happy to post code or the data model if that would help.
CarlosHi Murphy16,
Try investigate where are the principal issues in your RAC system.
Check:
* Expensive SQL's;
* Sorts in disks;
* Wait Events;
* Interconnect hardware issues;
* Applications doing unnecessary manual LOCKs (SQL);
* If SGA is adequatly sized (take care to not use of SWAP space "DISK");
* Backup's and unnecessary jobs running at business time (Realocate this jobs and backups to night window or a less intensive work hour at database);
* Rebuild indexes and identify tables that must be reorganized (fragmentation);
* Verify another software consuming resources on your server;
Please give us more info about your environment. The steps above are general, but you can use to guide u in basic performance issues.
Regards,
Rodrigo Mufalani
http://mufalani.blogspot.com -
Unable to read blob attributes in the Asset Filter
Hi,
I am unable to read a blob attribute in the Asset Filter using the following code.
The String attributes work fine.
Can I get some examples for reading blob attributes in the filter?
I am using Webcenter Sites 11gr1
public void filterAsset(IFilterEnvironment env, String filterIdentifier, FTValList filterArguments, IFilterableAssetInstance instance) throws AssetException
String inputattr = getAttrID(env, filterArguments, ARG_CUSTOM[0]);
IListBasic ilistbasic = instance.getAttribute(inputattr);
ilistbasic.getValue("value") // throws No such field exception.. works fine for string attribues
Thanks,
RajHi
In DTP, Filter there is option to write routine. The last button.
Here u can write the below code :
Select <fields> from table into itab.
Read itab into wa_itab where <condition>.
If sy_subrc = 0.
l_t_range-FIELDNAME = ' '. <give ur field name in source>
l_t_range-sign = 'I'.
l_t_range-option = 'EQ'.
l_t_range-low = wa_itab-field.
APPEND L_T_RANGE.
endif. -
Sql Server 2014 - Error message: Failed to read BLOB column
Hi all,
Am experiencing this error in Microsoft SQL Server 2014 - 12.0.2000.8 (X64) Enterprise Edition (Build 7601: Service Pack 1).
Error messages:
Message: Failed to read BLOB column
Stack: at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper)
at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.BcpOut(String strBcpObjectName, String strBcpObjectOwner, String strBaseBcpObjectName, Boolean fUnicodeConversion, String strDataFile, String strLoadOrderingHint, String
strWhereClause, Boolean useTableLockHint, Int32 bcpFileFormatVersion)
at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.DoWork(WorkItem workItem)
at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc()
at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQLServer, Error number: 0)
Get help: http://help/0
Message: Shared Memory Provider: No process is on the other end of the pipe.
Stack: (Source: MSSQLServer, Error number: 233)
Get help: http://help/233
Message: Communication link failure
Stack: (Source: MSSQLServer, Error number: 233)
Get help: http://help/233
Message: Shared Memory Provider: No process is on the other end of the pipe.
Stack: (Source: MSSQLServer, Error number: 233)
Get help: http://help/233
Message: Communication link failure
Stack: (Source: MSSQLServer, Error number: 233)
Get help: http://help/233
Please can you assist me on this issue.The error message states a communication link failure has occurred.
This is most likely a network related error and usually is transient.
Try to generate the snapshot again and see if the error still occurs. If the error still occurs, you will need to have a network admin check the links.
Brandon Williams (blog |
linkedin) -
Experts -
Is there any way that we can read the data from BLOB fields of data base table column in Endeca 3.0 ?
Do we have some direct readers for BLOB fields ? OR point # 2 below is the correct way in Endeca ?
Some details I could collect from search/google are below :
http://docs.oracle.com/cd/E29585_01/DeveloperStudio.61x/DevStudioHelp.pdf Says that directly CLOB / BLOBs are not supported by ENDECA
https://forums.oracle.com/thread/2426178 - Says a replacement for reading BLOB sources ' Oracle Endeca Advanced JDBC Column Handler 6.1.2 for Generic Platform'
Any help/pointers is highly appreciated.
Thank you,
RanishI see no reason why you shouldn't be able to bring a BLOB field into Endeca but I think the real question is what is the data and what are you trying to do with it?
If it's some kind of object (say, a serialized profile object about an account), wouldn't it make sense to de-serialize it and add some attribution to the Endeca record? If it's something else, like say an image file, you could probably hack something together to show it on a details page but bringing it in to the index would provide zero value over just having it somewhere else (like a web server). When I say no value in Endeca for an image, I mean, you can't search on it, you can't navigate on it, maybe you could display it (though you would create a lot of un-necessary work for yourself).
Probably need more detail here. Also, an additional note is that both links you include reference products and utilities that are part of the Oracle Endeca Commerce stack, not Oracle Endeca Information Discovery.
Patrick Rafferty
http://branchbird.com/blog/category/oeid/ -
Not able to Read Blob ( BlobDomain) Xml Data from DB
I am trying to read a BLOB file from Data base with the below code . However , i am facing 2 challenges - which i need ur help..
1. the data is not in readable format , may be i am missing some more code or encoding somewhere . ( this is how data is printing-- �B�...........)
2. Throwing an exception in the end
The Blob Data types appears as BlobDomain in the entity defination . My jdev is 11.1.1.5
+{+
+..............+
oracle.jbo.domain.BlobDomain blobDomainXml = (BlobDomain)r.getAttribute("Document");
System.out.println(" XML Out Put = "blobDomainXml);+
+}+
public ViewObject getBlobObject(){
return (ViewObjectImpl)findViewObject("getBlobObject1");
below is exception after the call ---
Caused by: java.lang.NullPointerException
at oracle.jbo.server.ViewRowSetIteratorImpl.getViewObject(ViewRowSetIteratorImpl.java:238)
at oracle.jbo.server.ViewRowSetIteratorImpl.getSyncLock(ViewRowSetIteratorImpl.java:178)
at oracle.jbo.server.ViewRowSetIteratorImpl.hasNext(ViewRowSetIteratorImpl.java:1904)
at com.stryker.gtc.view.bean.LoginPageName.getBlob(LoginPageName.java:243)
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:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)The Blob xml has used some encoding . If i use the below italic code in main class , i can get the proper xml . However , It uses the blob resultset but I get exception if i try with ADF blob domain .
below is the code in a simple main method class and gives me the desired xml .
ResultSet rset = statement.executeQuery("Select * from XML_DOCUMENT where DOCUMENT_ID=(Select DOCUMENT_ID from DOCUMENT_DLV_MSG_REF where MESSAGE_GUID = (Select MESSAGE_GUID from DLV_MESSAGE \n" +
"where CIKEY = (Select CIKEY from CUBE_INSTANCE where CMPST_ID='1931038')))");
+try {+
XMLDOMImplementation domimpl = new XMLDOMImplementation();
+while (rset.next()) {+
BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor() ;
BinXMLStream inpbin = proc.createBinXMLStream(rset.getBlob("DOCUMENT"));
BinXMLDecoder dec = inpbin.getDecoder();
InfosetReader xmlreader = dec.getReader();
XMLDocument doc = (XMLDocument)domimpl.createDocument(xmlreader);
doc.print(System.out);
+}+
+} catch (Exception e) {+
System.out.println(" Exception ="e);+
+}+
But , In ADF we have Blob Domian in the entity defination , auto generated ...
Row r = iter.next();
oracle.jbo.domain.BlobDomain blob = (*BlobDomain*)r.getAttribute("Document");
try
XMLDOMImplementation domimpl = new XMLDOMImplementation();
BinXMLProcessor proc = BinXMLProcessorFactory.createProcessor() ;
BinXMLStream inpbin = proc.createBinXMLStream(blob.getInputStream());
BinXMLDecoder dec = inpbin.getDecoder();
InfosetReader xmlreader = dec.getReader();
now in the above higlighted code I get java.lang.IllegalArgumentException . I do not find a way to convert BlobDomain to blob . even no decoder in blob Domain .
May be you can help ..
Edited by: Amitava Biswas on Sep 12, 2012 11:13 AM -
How to read BLOB column from a table in SQL or PL/SQL
I have table which is having one BLOB data type column . Ihave inserted few rows in that table . Now i want to see wheather BLOB column has been inserted properly or not . How to read that column through SQL or PL/SQL.
Can anyone help me to do this.You can only manipulate LOBs in PL/SQL because you have to use the DBMS_LOB package.
Check out the Oracle Developer's Guide -
Hi,
I'm trying to SELECT an table with an BLOB-Column 'SELECT * FROM xyz'.
If i set the 'InitialLOBFetchSize = -1' I get the following exception:
Unhandled Exception: System.Exception: TTC Error
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int32 initialLOBFetchSize, Int64[] scnFromExecution, Boolean& bAllPureInputBinds, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause)
at OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch)
at Oracle.ManagedDataAccess.Client.OracleDataReader.Read()
If i don't change the InitialLOBFetchSize everything works fine, but slow (because of the functionality of 'InitialLOBFetchSize = -1').
I use the ODP.Net managed driver 12.1.0.1.2, with the 12.1.0.1.0 i don't get these exception.
Regards,
Norman ArpIt depends on the database version
On a 11.2.0.2.0 database everything works fine
On a 10.2.0.4.0 database i get the exception -
Read blob 's data and write them to a table
I've managed at last to upload a blob to a table database (thanks to KUBA's)
Now I want to retrieve the blob from the database table , read it's contents and insert them to a new table. I want to do this after the upload process finishes...
the blob is always a txt file similar to this
GR;Greece
CY;Cyprus
Because I am a bit lost any guidelines would be very helpfull
thanksHi user571628. A couple of days ago I was working on the same thing, I couldn't finish the app. 'cause I was assigned to do other web app., I used the same example as you to upload the image to the DB and someone called "gnewtonaus" came up with what appears to be an excellent idea to do it, you have to use something called PL/SQL web toolkit (I have never used it and don't know how it works)... but this is what you have to do:
You've already solved the upload part so to download the BLOB (say an image in his example) you can use a simple PL/SQL stored procedure like the one below
E.g to display an image (from the DB) on an HTML page you just use
<!--
<img src="http://your_base_url:your_port/dad_name/package.display_photo?i_person_id=1234">
-->
-- Display a photo from the database
procedure display_photo(i_person_id in varchar2) is
v_blob blob;
begin
-- retrieve blob from database
select image into v_blob from pho_photos where person_id = i_person_id;
-- set http headers
owa_util.mime_header('image/jpeg', FALSE);
htp.p('Content-Length: ' || dbms_lob.getlength(v_blob));
owa_util.http_header_close;
-- initiate direct BLOB download
wpg_docload.download_file(v_blob);
exception
when others then
htp.p(to_char(sqlcode)||' - '||sqlerrm) ;
end; -- display_photo
Message was edited by:
gnewtonaus
If you get it running please post how you did it, bacause I'll have to come back and do it myself.
Regards -
Please help, I need to read blob and output in bytes from wwv_flow_files.
Hi all,
I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
The code under page 1 is as follows:
DECLARE
z number;
y varchar2(4000);
x varchar2(400);
b blob;
BEGIN
select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
select length(convertBlobToBytes(b)) into z from dual;
:P1_RESULT := z;
end;
Java code is as follows:
import java.io.*;
import java.sql.Blob;
public class convertBlob {
* @param blob
* @return
public static byte[] convertBlobToBytes(Blob blob) {
if (blob==null) return null;
try {
InputStream in = blob.getBinaryStream();
int len = (int) blob.length(); //read as long
long pos = 1; //indexing starts from 1
byte[] bytes = blob.getBytes(pos, len);
in.close();
return bytes;
catch (Exception e) {
System.out.println(e.getMessage());
return null;
PL/SQL wrapper is as follows:
CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
But I am getting the length of the file, as twice the size.
For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
And hence I am getting wrong results, further in the process.
Can you please help me? Any help is appreciated.
rgds,
Suma.The example on this page is showing how to read a blob in portions you determine yourself:
http://apex.oracle.com/pls/otn/f?p=31517:91
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Stuck threads reading blob column from db table
WLS 10.3.5, JDK 1.6u29, Oracle 11g RAC, ojdbc6 latest driver
We're having problems with stuck threads trying to read a blob column from a DB table. The query to extract the blob is a simple select, without any locking such as "for update" clauses or whatever. The blob's size is <= 100k.
The thread dump shows the following stack trace:
+"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
+ java.net.SocketInputStream.socketRead0(Native Method)+
+ java.net.SocketInputStream.read(SocketInputStream.java:129)+
+ oracle.net.ns.Packet.receive(Packet.java:300)+
+ oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
+ oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
+ oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
+ oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
+ oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
+ oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
+ oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
+ oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
+ oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
+ oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
+ oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
+ oracle.sql.BLOB.getBytes(BLOB.java:348)+
+ oracle.sql.BLOB.getBytes(BLOB.java:222)+
+ weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
+ com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
+ com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
+ com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
+ com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
+ com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
+ com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)+
+ com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
+ com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
+ com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
+ com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
+ com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
+ com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)"[STUCK] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE native+
+ java.net.SocketInputStream.socketRead0(Native Method)+
+ java.net.SocketInputStream.read(SocketInputStream.java:129)+
+ oracle.net.ns.Packet.receive(Packet.java:300)+
+ oracle.net.ns.DataPacket.receive(DataPacket.java:106)+
+ oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)+
+ oracle.net.ns.NetInputStream.read(NetInputStream.java:260)+
+ oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:105)+
+ oracle.jdbc.driver.T4CMAREngine.getNBytes(T4CMAREngine.java:1517)+
+ oracle.jdbc.driver.T4C8TTILobd.unmarshalLobData(T4C8TTILobd.java:476)+
+ oracle.jdbc.driver.T4C8TTILob.readLOBD(T4C8TTILob.java:770)+
+ oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:361)+
+ oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)+
+ oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)+
+ oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2392)+
+ oracle.sql.BLOB.getBytes(BLOB.java:348)+
+ oracle.sql.BLOB.getBytes(BLOB.java:222)+
+ weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB.getBytes(Unknown Source)+
+ com.ibatis.sqlmap.engine.type.BlobTypeHandlerCallback.getResult(BlobTypeHandlerCallback.java:33)+
+ com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52)+
+ com.ibatis.sqlmap.engine.mapping.result.ResultMap.getPrimitiveResultMappingValue(ResultMap.java:619)+
+ com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:345)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)+
+ com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)+
+ com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)+
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
+ com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)+
+ com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)+
+ com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)+
+ com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)+
+ com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)+
+ com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:282)+
Some threads eventually end (after 1-2 hours), most of them remain there for days.
Any hint would be quite useful, thanks.Threads are executing the actual allocated request from the Weblogic Kernel. Most of the problems happen when the Thread execution is reaching the application or business layer.
At this point your application Java code module is sending or receiving data from external sources such as a an Oracle database for example. Any problem with such external system will cause the Thread to hang and wait for data to come back.
Other situations can occur such as internal deadlock, infinite looping, heavy IO contention on your server etc.
Doesn't loo like a driver issue.
http://docs.oracle.com/cd/E21764_01/doc.1111/e14770/weblogic_server_issues.htm#autoId2
Check at the Database end
Cheers ... -
Need help reading BLOB on a Zaurus
I know the topic of BLOBs comes up a lot, but I couldn't find an answer to my problem after searching the existing posts.
I'm trying to retrieve an image stored as a BLOB in an oracle DB.. The code works fine on my PC when I use getBLOB (commented out section of the code), but the target device (Zaurus or other Linux handheld) is limited to the Java 1.2 API. I changed the code to use getBinaryStream instead. Everything seems to work on the PC, but it still fails on the Zaurus. Not sure why. Any ideas?
stmt = connection.createStatement();
records = stmt.executeQuery(HOTEL_SECTION_IMAGE_QUERY);
while (records.next()){
if (DEBUGGING_TEXT_ON)System.out.println("Reading Record");
/*Blob image_blob=records.getBlob(3);
if (image_blob == null){
if (DEBUGGING_TEXT_ON)System.out.println("No image BLOB found");
}else{
if (DEBUGGING_TEXT_ON)System.out.println("Image BLOB found");
if (DEBUGGING_TEXT_ON)System.out.println("Image BLOB size: " + image_blob.length());
AppVariables.hotel_section_image = Toolkit.getDefaultToolkit().createImage(image_blob.getBytes(1L, (int) image_blob.length()));
java.io.InputStream blob_stream;
byte[] blob_buffer = new byte[0];
byte[] blob_stream_packet = new byte[1];
int temp;
blob_stream = records.getBinaryStream (3);
if (records.wasNull()){
if (DEBUGGING_TEXT_ON)System.out.println("Record was NULL.");
}else{
if (DEBUGGING_TEXT_ON)System.out.println("BLOB Found");
while ((temp = blob_stream.read(blob_stream_packet)) != -1) {
if (DEBUGGING_TEXT_ON)System.out.println("Reading " + temp + " bytes from Image BLOB");
if (DEBUGGING_TEXT_ON)System.out.println("Current Byte = " + blob_stream_packet[0]);
byte[] temp_buffer = new byte[blob_buffer.length];
System.arraycopy(blob_buffer, 0, temp_buffer, 0, blob_buffer.length);
if (DEBUGGING_TEXT_ON)System.out.println("Extending BLOB buffer");
blob_buffer = new byte[temp_buffer.length + 1];
System.arraycopy(temp_buffer, 0, blob_buffer, 0, temp_buffer.length);
if (DEBUGGING_TEXT_ON)System.out.println("Adding packet to BLOB buffer");
blob_buffer[blob_buffer.length - 1] = blob_stream_packet[0];
AppVariables.hotel_section_image = Toolkit.getDefaultToolkit().createImage(blob_buffer);
records.close();
stmt.close();Error output is:
Reading Record
Record was NULL.
Reading Record
Record was NULL.
Reading Record
Record was NULL.
Reading Record
Record was NULL.
Reading Record
Record was NULL.
Reading Record
Exception occurred during event dispatching:
java.lang.NoClassDefFoundError: java/sql/Blob
at oracle.jdbc.driver.OracleStatement.get_blob_value (bytecode 15)
at oracle.jdbc.driver.OracleStatement.getBinaryStreamValue (bytecode 410)
at oracle.jdbc.driver.OracleResultSetImpl.getBinaryStream (bytecode 6)
at windows.LoginView.checkLogin (bytecode 278)
at windows.LoginView$LoginListener.actionPerformed (bytecode 14)
at java.awt.Button.processActionEvent (bytecode 12)
at java.awt.Button.processEvent (bytecode 12)
at java.awt.Component.dispatchEventImpl (bytecode 173)
at java.awt.Component.dispatchEvent (bytecode 2)
at java.awt.EventDispatchThread.run (bytecode 51)
Thanks in advance.
Message was edited by:
RDLake
Message was edited by:
RDLake1. There is a rather long, in-depth article in the wiki already. Have a look here and here
2. is discribed there as well.
3. There is a rather long, in-depth article in the wiki already.
Last edited by JackH79 (2011-04-08 05:27:58) -
Hi,
I want to read data in text format from the BLOB column
XML_col is the column with BLOB datatype in TEST table.
select BLOB2VARCHAR(XML_col) from TEST;
I created BLOB2VARCHAR function to convert from BLOB to Varchar.
CREATE OR REPLACE FUNCTION TEST_fnc (html IN BLOB)
RETURN VARCHAR2
IS
tmpvar NUMBER;
tmpchr VARCHAR2 (4000);
BEGIN
tmpchr := UTL_RAW.cast_to_varchar2 (DBMS_LOB.SUBSTR (html, 4000, 1));
tmpchr := SUBSTR (tmpchr, 1, 4000);
RETURN tmpchr;
EXCEPTION
WHEN OTHERS
THEN
RETURN NULL;
END blob2varchar;
I am getting output as ’
Which i guess is wrong.Hi,
This will print your output character by character
Try this and let me know
DECLARE
v_read_bytes BINARY_INTEGER;
v_pos INTEGER;
v_blob_len INTEGER;
v_buffer RAW(200);
v_file_data fnd_lobs.file_data%TYPE;
BEGIN
SELECT file_data
INTO v_file_data
FROM fnd_lobs
WHERE file_id = 121708;
v_blob_len := DBMS_LOB.getLength (v_file_data);
v_pos := 0;
v_read_bytes := 1;
WHILE v_pos <= v_blob_len
LOOP
v_pos := v_pos + 1;
DBMS_LOB.read (v_file_data, v_read_bytes, v_pos, v_buffer);
DBMS_OUTPUT.PUt_line(utl_raw.cast_to_varchar2(v_buffer));
END LOOP;
END; -
JDBC java.io.IOException: IO Error: Unexpected packet error reading BLOB
Oracle JDBC driver threw exception _"java.io.IOException: IO Error: Unexpected packet"_ - while reading data from a BLOB column.
Any help in resolution please?
Database Version: Oracle Database 11g Enterprise Edition Release _11.2.0.2.0_ - 64bit Production.
Database configuration: This is a single-server, non-RAC Oracle 11g, With the Partitioning, OLAP, Data Mining, Real Application Testing options and High compression.
JDBC driver: ojdbc6.jar with manifest information as below:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_17-b02 (Sun Microsystems Inc.)
Implementation-Vendor: Oracle Corporation
Implementation-Title: JDBC
Implementation-Version: _11.2.0.1.0_
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0
Main-Class: oracle.jdbc.OracleDriver
Here is the complete stack trace (excluding my custom exception handler):
Caused by: java.io.IOException: IO Error: Unexpected packet
at oracle.jdbc.driver.OracleBlobInputStream.needBytes
(OracleBlobInputStream.java:204)
at oracle.jdbc.driver.OracleBufferedStream.readInternal
(OracleBufferedStream.java:169)
at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.
java:143)
at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.
java:132)
... 91 more
Caused by: java.sql.SQLRecoverableException: IO Error: Unexpected packet
at oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2325)
at oracle.sql.BLOB.getBytes(BLOB.java:319)
at oracle.jdbc.driver.OracleBlobInputStream.needBytes
(OracleBlobInputStream.java:181)
... 100 more
Caused by: oracle.net.ns.NetException: Unexpected packet
at oracle.net.ns.NetException.(NetException.java:183)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:222)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket
(T4CSocketInputStreamWrapper.java:118)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read
(T4CSocketInputStreamWrapper.java:78)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1155)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)
at oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2313)
... 102 more
.jfdenise wrote:
Hi,
I am facing the exact same issue when getting a big jar of more than 7 megs. It seems to occur in some special network configuration that I am not yet able to figure out. It is obviously linked to the fact that the jar is unpacked on the client side.
Anybody ran into this one and understood the root cause?Please, don't resurrect old threads, and don't use signatures with addresses. I'm locking this thread.
Kaj
Maybe you are looking for
-
Grid installation in solaris 10 (sparc) with Suncluster
While installing grid for cluster, node information table appears as blank.. while clicking "use cluster configuration file" option in that screen it shows that vendor clusterware detected. cluster configuration cannot be modified.. If anyone knows h
-
Error in sending SMS through OCSG
Hi All, I have a program which send SMS thru OCSG, but i am seeing following error after 30 to 45 minutes and after error again SMS broadcast successfully I see errors in following file C:\bea\user_projects\domains\ocsg-domain\servers\AdminServer\tra
-
Can't get postfix to send to google
i'm trying to set up postfix to send to my google account, but it keeps timing out. in /etc/postfix/main.cf i have myhostname = localhost.localdomain. i'm on a cable internet connection. any ideas? Oct 5 01:27:43 karstenhome postfix/postfix-script
-
Blue Screen and Mini Display Port Screens
I have a Macbook Air 2011 model, it will connect fine to any Thunderbolt displays but as soon as it's plugged into a screen with the mini display port connector, the laptop will get stuck on a blue screen until it's disconnected, and as far as I know
-
Does Windows CS2 qualify for CS5 upgrade
I got CS2 so I could process my Olympus C-8080 raw files, but my Olympus E-620 raw files require a later version. I am wondering if the CS5 upgrade will work with my CS2. This page makes it look like CS2 qualifies: http://www.adobe.com/products/photo