Oracle 9.2.0.8 Binary Data Problem

Hi Folks,
need some advice from the experts here about an error I got yesterday while installing a (Java-based) Software at a customer using Oracle 9.2.0.8.
While being able to work with the database most of the time, I get an error when trying to save binary data. Unfortunately I don't have access to the DB-logs, so I hope the log I have may raise a thought or two from anybody and that may help me bring some light into the darkness I'm poking in at the moment.
<log>
java.sql.SQLException: No more data to read from socket
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
     at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
     at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java:962)
     at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java:894)
     at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:103)
     at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:693)
     at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:731)
     at oracle.jdbc.driver.OraclePreparedStatement.privateClose(OraclePreparedStatement.java:535)
     at oracle.jdbc.driver.OraclePreparedStatement.close(OraclePreparedStatement.java:440)
     at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.close(DelegatingStatement.java:168)
</log>
I searched around and got some results about
- codepage: The DBA told me that the DB is using "cp1252", so I tried to use both ISO-8859-1 and UTF-8 (both are supported by the application)
- Session Management: Tried to raise/decrease the limits for idle/maximum connections and the DBA told me to set the parameter "SESSION_CACHED_CURSORS=0", but unfortunately this is not possible when using a connection URL "jdbc:oracle:thin:@..."
So... if anybody has an idea what to check or ask the DBA to change or almost anything, I'd kindly welcome the feedback.
Thanks,
enni

Hi Sybrand,
thank you for your clarification for the codepage!
And no, I don't think that I found a new issue, just wasn't able to find a good answer on the net and after trying to get an evaluation copy (just for the install and first tests) of Oracle 9, the support told me "No way.".
And yes, you're definitely right, it should be buried.
But we all know that there are companies out there that allow new applications tests on thier "good'old" DB. Guess that is exactly what happens here.
Maybe somebody else reads this and had similiar problems in the past, so I keep this "open" for just some more time.
Thanks,
have a good time!
enni

Similar Messages

  • Binary data problem with web services on JRockit but not Sun JDK

    I have a problem with binary data in SOAP and JRockit
    (jrrt-3.0.0-1.6.0-linux-x64.bin) . I have an set of web services based
    on EJB 3.0 which return images as byte arrays inside a SOAP envelope
    to be consumed by .NET 2 services. The host app server is Oracle
    Application Server 10.3.1 on RHEL Linux update 4, on 64 bit Xeon 5500
    series HP blade hardware.
    While most images are fine most of the time, one particular image
    gives this message when being consumed in the .NET client:
    The '■' character, hexadecimal value 0x1F, cannot be included in a
    name. Line 2, position 380038.
    The MSDN suggests that this is usually caused by non-escaping of reserved XML characters like < but this isn't one of those.
    The SOAP looks ok and for the life of me I can't see why this ought to
    be a problem, especially since the problem doesn't arise running with
    the SUN JDK 1.6_06 64 bit)
    When making the same call from the OAS Enterprise Manager, I can make the same call with no problem (but the data is just rendered as character data in a browser) which maybe suggests some incompatibility with how JRockit is serializing the data ?
    Any ideas, I would be very happy to hear - JRockit gives a 15% or so
    speed boost to the website that these services power so obviously we
    want to use it if possible.
    Edited by: RichLiv on Nov 14, 2008 4:54 AM

    Seems to be the case that using MTOM stops this problem with JRockit. Strange but apparently true (so far).

  • Stored Procedure w/ binary data parameter problems in Visual Basic

    Howdy all.
    I am having a problem calling stored procedures with a BLOB parameter. I have tried changing the paramater other data types to see if it would work, but with no success. I am calling the stored procedure from Visual Basic using ADO. I am using the Oracle ODBC Driver, Release 9.2.0.4.0. I have tried changing the setup of the ODBC a good bit because that has fixed several problems for me in the past; however, it did not fix my current problem.
    Here is what I am trying to do. I have a function like the folowing:
    <BEGIN --------------------------------------->
    CREATE OR REPLACE FUNCTION PAGEFORMATSINSERT(
    p_ObjectFormatCode_ID      IN RAW DEFAULT NULL,
    p_PA_ID      IN RAW DEFAULT NULL,
    p_Name      IN VARCHAR2 DEFAULT NULL,
    p_FormatData      IN BLOB DEFAULT NULL,
    p_PF_ID      IN OUT RAW )
    RETURN INTEGER
    AS
    BEGIN
    INSERT INTO PAGEFORMATS (PF_ID, ObjectFormatCode_ID, PA_ID, Name, FormatData) /* <---- this FormatData column is a BLOB column */
    VALUES     (p_PF_ID, p_ObjectFormatCode_ID, p_PA_ID, p_Name, p_FormatData)
    END PAGEFORMATSINSERT;
    <END ----------------------------------------->
    The FormatData parameter has a data type of BLOB. In my Visual Basic, I have my ADODB.Command object. I am setting the CommandText of the Command object to "{? = call PageFormatsInsert(?, ?, ?, ?, ?)}". In order to set the parameter value for the BLOB data type, I am calling the AppendChunk function of the Command object - passing it a Byte array.
    I am getting the folling error:
         ERROR: -2147467259 [Oracle][ODBC][Ora]ORA-06550: line 1, column 13:
         PLS-00306: wrong number or types of arguments in call to 'PAGEFORMATSINSERT'
         ORA-06550: line 1, column 7:
         PL/SQL: Statement ignored
    If I change the FormatData parameter to a LONG RAW parameter, I get the following error:
         ERROR: -2147467259 [Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
         ORA-06512: at line 1
    I am at a loss as to how to get binary data into by Oracle database. I need to do it using stored procedures. How can I set up my stored procedure or table to do what I want it to do? Should I change my table definition? Are there some settings in the ODBC connection I can tweak? How can I get the stored procedure to accept my call from VB ADO?
    Any help would be appreciated.
    wally

    Thanks for the idea, but I don't get how I am supposed to get my binary data to the stored procedure using the stream. I have a binary array that I want to pass to a stored procedure. I want to be able to use the same Visual Basic front end with out MSSQL database as with our Oracle database.
    I am using the ADODB Connection and Command and RecordSet objects. Currenlty our front end calls the ADODB.Command(ParamNumber).AppendChunk function passing it the binary array. Somehow, the SQL Server driver does the magic in order for the MSSQL stored procedure to work correctly. I need to know how to do one of the following:
    1. Get the Oracle driver to do the same magic.
    2. Set up the Oracle stored procedure so I don't have to change the VB front end.
    3. Change the VB front end so that it works with both MSSQL and Oracle.
    wally

  • Define BINARY DATA column (DB2 to Oracle migration)

    Have a table where a column is defined as 'FOR BIT DATA'. This specifies that the contents of the column are to be treated as bit (binary) data. During data exchange with other systems, code page conversions are not performed. Comparisons are done in binary, irrespective of the database collating sequence.
    During conversion to Oracle using Oracle Migration Workbench, this table is converted irrespective of this definition. Please see below for details:
    DB2 table definition:
    CREATE TABLE ADMIN.XENCY (
              ID INTEGER NOT NULL ,
              XENCYSYMBOL CHAR(2) FOR BIT DATA NOT NULL ,
              IN TS_XENCY ;
    Oracle table definition as generated by OMWB:
    CREATE TABLE ADMIN.XENCY
    ( ID NUMBER(10,0) NOT NULL ENABLE,
    XENCYSYMBOL CHAR(2) NOT NULL ENABLE,
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE TS_XENCY;
    During data loading from DB2 to Oracle it fails for this table with the following error:
    Type: Error
    Time: 14-08-2006 18:21:02
    Phase: Migrating
    Message: Unable to migrate data from source table ADMIN.XENCY to destination table ADMIN.XENCY : ADMIN.XENCY; ORA-12899: value too large for column "ADMIN"."XENCY"."XENCYSYMBOL" (actual: 4, maximum: 2)
    For Oracle the length of the data in this column is 4; however for DB2 it is 2 only as shown below:
    $ db2 "select max(length(Xencysymbol)) from admin.Xency with ur"
    1
    2
    1 record(s) selected.
    $     
    The distinct contents of this table is as follows:
    $ db2 "select distinct Xencysymbol from admin.Xency with ur"
    XENCYSYMBOL
    x'0024'
    x'2020'
    2 record(s) selected.
    $
    How do I define a column as containing binary data in Oracle?
    Thanks in advance.

    The MWB DB2 LUW plug-in incorrectly translates CHAR FOR BIT. Doesn't particularly pay attention to any of the CHAR modifiers. It will just see that column as a CHAR. Obviously, this is a defect.
    Binary data of limited length is stored in RAW type columns in Oracle DB.
    You have two problems (in addition to issuing an ALTER COLUMN to fix the type delcaration or dropping, tweaking the table creation script and reloading. )
    1. The data extraction scripts utilized for that table have not properly encoded the data for transport between DB systems. If there are endian differences between he source and target platform there may be additional problems. Nominally, you can export the binary data in hex format.
    2. The SQL*Loader file needs to be adjusted. (if you dump in hex format, so the data in the file is characters of a hex value )
    XENCYSYMBOL CHAR : hextoraw( : XENCYSYMBOL)
    Loader will convert those hex characters back into RAW as it loads.
    [ The  built in data pump will not work obviously because the system thinks it is a CHAR. So offline data transfer is your only option.  ]

  • Download file problem for binary data?

    Dear All,
    I have wrote a jsp file to do download page. I have used a piece of code from the JDC to this. This code will prompt the download dialog box each time user clicks the download button. The code itself will set the content type for different application. The code is like below:
    try
    java.io.File fileobj = new java.io.File(strFolder + strFile);
    response.setContentType(application.getMimeType(fileobj.getName()));
    response.setHeader("Content-Disposition","attachment; filename=\""
    + strFile + "\"");
    java.io.FileInputStream in = new java.io.FileInputStream(fileobj);
    int ch;
    while ((ch = in.read()) != -1) {
    out.write(ch);
    out.flush();
    in.close();
    } catch(Exception e)
    The code can download and handle text file correctly when it is openned in the text editor or inside the IE. But when a PDF file or Image is downloaded and openned in the PDF viewer or image viewer, it is corrupted and cannot be viewed. What is the problem? Any ideas?
    So, I wonder this code can handle binary data or not. It is seen like there is no different code to handle text and binary data in Java/Jsp.
    Thank you very much!
    Best Regards,
    Rockyu Lee
              

    Add following lines to .tld file (custom tag definition)
    <tag>
    <name>downloadbinary</name>
    <tagclass>org.rampally.DownloadBinaryTag</tagclass>
    <bodycontent>JSP</bodycontent>
    </tag>
    Add following line to JSP files.
    In JSP, keep one line of source. Make sure that there are no space and additional line feeds at the any where
    in the JSP files except JSP tags.
    <%@ taglib uri="/WEB-INF/taglibs/mb.tld" prefix="mytags" %>
    <mytags:downloadbinary />
    I am hoping that you have all required parameters such as fileName to download, etc.
    in your session or request object.
    Tag class ....
    public class DownloadBinaryTag extends TagSupport {
         public int doEndTag() throws JspException {
              // TODO: get binary data from filename or
              // binary data buffer from datase.
              // I am making it simple .. assume that it is a request parameter for
              // you test easily.
              String fileName = request.getParameter( "filename" );
              java.io.File file = new java.io.File( fileName);
              java.io.DataInputStream dis;
              try {
                   dis = new java.io.DataInputStream(new FileInputStream(fileName));
              } catch (FileNotFoundException e) {
                   // do error handling ...
                   return EVAL_PAGE;
              BinaryUtil.sendBinaryFile( dis, (HttpServletResponse) pageContext.getResponse(), contentType );
              return EVAL_PAGE;
    public class BinaryUtil
         static public void sendBinaryFile( DataInputStream dis,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   int len;
                   byte[] data = new byte[128 * 1024];
                   while ((len = dis.read(data, 0, 128 * 1024)) >= 0)
                        sout.write(data, 0, len);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
         static public void sendBinaryFile( byte[] data,
                                  HttpServletResponse response,
                                  String contentType ) {
              try {
                   response.setContentType(contentType);
                   String fileName="test.pdf";
                   response.setHeader("Content-disposition", "inline; filename=" + newFileName );
                   ServletOutputStream sout = response.getOutputStream();
                   sout.write(data);
                   sout.flush();
                   sout.close();
              } catch (Exception e) {
                   System.out.println(e.getMessage());
    You may have to change 'inline' to 'attachment' if you do not want IE to inline the document.
    That's all!!.. Hope this helps...!

  • How to use Binary data in Oracle(OLE DB)?

    I have the Oracle 8.1.6, I can store VARCHAR2 or CBLOB into oracle database(by DBTYPES_STR). But can NOT store binary data(DBTYPES_BYTES)such as RAW, BLOB into database. My platform is VC++,ATL,OLE DB, consumer. I try to use the Oracle tools to do that, but do not successful? Can you tell me how to store data into binary column in oracle?
    Thank you

    Better to trim those values after the form submission.
    Once you put them into form,
    user may also makes mistake by hitting space, right?
    Also, by trimming all form fields after submission, you will
    be sure that your DB is clean... no whitespaces on it.
    Well unless someone insert data directly onto it :)

  • Encoding problem while reading binary data from MQ-series

    Dear all,
    we are running on 7.0 and we have an encoding problem while reading binary data from MQ-series. Because we are getting flat strings from queue we use module "Plain2ML" (MessageTransformBean) for wrapping xml-elements around the incoming data.
    The MQ-Series-Server is using CCSID 850, which we configured in connection parameters in communication channel (both parameters for Queuemanager CCSID and also CCSID of target).If there are special characters in the message (which HEX-values differ from codepage to codepage) we get errors in our adapter while executing, please see stack-trace for further analysis below.
    It seems to us that
    1. method ByteToCharUTF8.convert() expects UTF-8 in binary data
    2. Both CCSID parameters are not used anyway in JMS-adapter
    How can we solve this problem without changing anything on MQ-site?
    Here is the stack-trace:
    Catching com.sap.aii.af.mp.module.ModuleException: Transform: failed to execute the transformation: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.af.modules.trans.MessageTransformBean.throwModuleException(MessageTransformBean.java:453)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:387)
        at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl0_0.process(ModuleLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:292)
        at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0_0.process(ModuleProcessorLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.adapter.jms.core.channel.filter.SendToModuleProcessorFilter.filter(SendToModuleProcessorFilter.java:84)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertBinaryToXiMessageFilter.filter(ConvertBinaryToXiMessageFilter.java:304)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:112)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:87)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filterSend(TxManagerFilter.java:123)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filter(TxManagerFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.DynamicConfigurationFilter.filter(DynamicConfigurationFilter.java:72)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.PmiAgentFilter.filter(PmiAgentFilter.java:66)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundCorrelationFilter.filter(InboundCorrelationFilter.java:60)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JmsHeadersProfileFilter.filter(JmsHeadersProfileFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageInvocationsFilter.filter(MessageInvocationsFilter.java:89)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JarmMonitorFilter.filter(JarmMonitorFilter.java:57)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ThreadNamingFilter.filter(ThreadNamingFilter.java:62)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.SenderChannelImpl.doReceive(SenderChannelImpl.java:263)
        at com.sap.aii.adapter.jms.core.channel.ChannelImpl.receive(ChannelImpl.java:437)
        at com.sap.aii.adapter.jms.core.connector.MessageListenerImpl.onMessage(MessageListenerImpl.java:36)
        at com.ibm.mq.jms.MQMessageConsumer$FacadeMessageListener.onMessage(MQMessageConsumer.java:399)
        at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl$JmsProviderMessageListener.onMessage(JmsMessageConsumerImpl.java:904)
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageConsumer.receiveAsync(MQMessageConsumer.java:4249)
        at com.ibm.msg.client.wmq.v6.jms.internal.SessionAsyncHelper.run(SessionAsyncHelper.java:537)
        at java.lang.Thread.run(Thread.java:770)
    Caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:714)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:538)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:528)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:471)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:364)
        ... 36 more
    Caused by: sun.io.MalformedInputException
        at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:270)
        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:287)
        at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:337)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:223)
        at java.io.InputStreamReader.read(InputStreamReader.java:208)
        at java.io.BufferedReader.fill(BufferedReader.java:153)
        at java.io.BufferedReader.readLine(BufferedReader.java:316)
        at java.io.LineNumberReader.readLine(LineNumberReader.java:176)
        at com.sap.aii.messaging.adapter.Conversion.convertPlain2XML(Conversion.java:310)
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:709)
        ... 40 more
    Any ideas?
    Kind regards, Stefan

    Hi Stefan,
    for the first MTB now we are using only one parameter: Transform.ContentType = text/plain;charset="ISO-8859-1"
    The second MTB, which does the XML-Wrapping, is configured like this:
    Transform.Class = com.sap.aii.messaging.adapter.Conversion
    Transform.ContentType = application/xml
    xml.conversionType = SimplePlain2XML
    xml.fieldNames = value
    xml.fieldSeparator = §%zulu§%
    xml.processFieldNames = fromConfiguration
    xml.structureTitle = payload
    Both CCSID configuration parameters from the "Source"-Tab we've set to 850.
    Now, we don't get an error anymore - sun.io.malformedInputException - , but, unfortunately, now special character conversion succeeded (we need an "ß" and we get an ISO-HEX-E1 -> á).  E1 is (different from ISO) an "ß" in 850.
    Any ideas?

  • The problem of using webservice to transfer binary data

    I want to use webservice to realize downloading file , and then I think we can to transform the whole file to binary data ,and then use webservice to deliver these datas to client. but there is a promble. When the file size is a bit large , such as exceeding 1.5M , then client will receive error report. How to solve this promble. Another I think when server transforming the whole file to binary data , It should apply for much memory , as large as the file. I think this is not a good solution . Any one can give me some ideas ? How to realize download file using webservice(the server is oc4j)

    839507 wrote:
    the picture does not synchronize with sound. Why? Where is the problem??Dear Automotive Mechanic,
    My car won't start, where is the problem?
    Sincerly,
    Captain Foss

  • Problems with Concatenating Binary Data

    Hi
    I am experiencing a problem with the unreliable concatenation of binary data.
    I have a stored procedure that I wrote to perform cell encryption on long text fields (> 4000 characters in length). This takes the string, splits it into chunks of a set length, encrypts and concatenates the encrypted chunks into a varbinary(max) variable.
    It then stores the length of the encrypted chunk at the beginning of the data (the length of output when encrypting strings of a set length is always be the same), e.g.
    DECLARE @output VARBINARY(MAX), @length INT
    SELECT @length = LEN(@encryptedchunk1)
    SELECT @output = CONVERT(binary(8), @length) + @encryptedchunk1 + @encryptedchunk2 + @encryptedchunk3 + ...
    So far so good, and when I decrypt the data, I can read the first 8 bytes of data at beginning of the binary data to get the length of the chunk:
    -- get the length of the encrypted chunk
    SELECT @length = CONVERT(INT, CONVERT(binary(8), LEFT(@encrypteddata, 8)))
    -- then remove the first 8 bytes of data
    SELECT @encrypteddata = CONVERT(VARBINARY(MAX), RIGHT(@encrypteddata, LEN(@encrypteddata) - 8))
    <snip> code to split into chunks of length @length and decrypt
    </snip>
    This is where I am experiencing an issue. 99.4% of the time, the above code is reliable. However, 0.6% of the time this fails for one of two reasons:
    the length is stored incorrectly. The length of the encrypted chunks is usually 4052 and substituting 4052 for the returned value (4051) allows the encrypted chunks to be decrypted.
    the encrypted data sometimes starts at offset 8 instead of 9. The @length variable is correctly read at length 8 but only 7 bytes should be removed from the start, e.g.
    SELECT @length = CONVERT(INT, CONVERT(binary(8), LEFT(@encrypteddata, 8)))
    SELECT @encrypteddata = CONVERT(VARBINARY(MAX), RIGHT(@encrypteddata, LEN(@encrypteddata) - 7))
    Has anyone any ideas on why this is happening and how the process can be made more reliable?
    Julian

    Use datalength, not len. Len() is designed for character strings and will ignore trailing bytes. And count characters. Datalength does exactly what you want: it counts bytes. Look at this:
    DECLARE @b varbinary(200)
    SELECT @b = 0x4142434420202020
    SELECT @b, len(@b), datalength(@b)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Parsing  Binary data to XML

    Hi,
    I am new for ALSB and I have problem with it.
    How can I transform binary Data to xml. The binary datas are in a directory and after mapping to xml, I want them to have in other directory or in Oracle DB.
    With Query tool I created binary_to_XML.xq file but can't use it in ALSB.
    ALSB passes the files with out mapping?!
    Thanks,
    Emulate

    The ALSB forum is http://forums.bea.com/bea/category.jspa?categoryID=600000003

  • Best Datatype for Binary Data

    Hi,
    We storing a Binary Data say "€ù?" in oracle as String Datatype.
    I have formed the query in my application to insert a record which has above string as one of the String field value.
    The insertion was success but when the above string is not stored as it is but it is stored as "¿ù?" which is not a correct data.
    Is this problem is because I'm using string for storing binary data?
    Also please let me know what could be the best data type to store the binary data (like above data) in oracle.

    Justin,
    With the help of your query I identified how the bytes are stored in the memory.
    I'm having VARCHAR2 datatype of size 14 in oracle when ever i store my binary data it is storing as
    127,0,0,0,0,0,0,0....for 14 bytes -> So the binary equivalent is 011111111,00000000,00000000,...... And i'm ok with it.
    But the problem is whenever a byte is holding the binary equivalent of 128 it is storing in the oracle as 191
    eq:
    Bits: 10000000 => equivalent to 128 in decimal and it is what i want to get when i query it using select, but what i'm getting in sql query is "191".
    Really I'm not able to understand the relationship beween 128 and 191 binary values.
    I got the above detail using the DUMP sql function.

  • Horizontal scaling, with large amounts of binary data

    question about horizontal scaling. tried asking late last night, but no one was active. Basically, I have an app that needs to scale (by adding new machines all talking to a database in the backend). This is all fine, but I have some binary file storage requirements for the app (files over 80 megs in size). This introduces a concurency issue, as I can't store this binary data on any of the individual server (because then it will be on one, and not all, leaving the app in an inconsistent state). So where do I store the data to enforce a consistent state? Have the individual apps FTP the file to a central location?
    I am trying to avoid storing binary data in the database; Does anyone have any suggestions on how to address this problem?

    I understand why you are trying to avoid storing binary data in a database but if you need to ensure that this data cannot be modified without the appropriate restrictions then using a database might make sense. You could even have a separate database just for the binary data because you will need to ensure you get the block sizing correct. Also, some databases might be better than others in this case. For example Oracle is likely to be significantly better than MySQL.
    If you do want to use files then you need to put the file in a central location and enforce locking the file to prevent concurrent modification. You can probably tie into a protocol that automatically handles this for you.

  • How to upload large binary data to dB so it can be read by any app?

    Hi everyone,
    Short version: how do you upload binary data into a MySQL blob field in such a way that it can be read by any application?
    Long version:
    I've been struggling with the problem of putting files into database BLOB fields. (MySQL and Database Connectivity Toolkit).
    I was initially building a query string and executing the query but was finding that certain binary characters were causing failures (end of string terminators, etc...) So, a working solution was to encode the binary string, and that worked fine, although bloated the dB a fair bit. I could decode in LabVIEW and then save the file as needed.
    Now, the customer wants to be able to save the files using other apps, including the MySQL Query Browser, so an encoded file is no good.
    I found using a parametrized query allows me to put the unencoded string into the dB, but it appends a 4-byte length at the front of the BLOB before it inserts it into the dB. Some apps ignore these 4-bytes (such as .pdf) but most do not.
    A related thread on NI discussion forums: http://forums.ni.com/ni/board/message?boar...ssage.id=354361 has no solution, and my support ticket at NI has been ongoing without answer for a while.
    Thanks,
    Ben

    The problem is the DCT. Using ADO it is fairly easy to insert binary data into a BLOB field. I have not tried it in MySQL, but it works fine in SQL Server, Oracle, Firebird and other free/open source databases I have tried. To get you started, see this thread.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Need to convert the binary data in blob field to readable format

    Hi,
    We need to convert the Binary data in the BLOB field to readable format and need to display it in Oracle Apps Environment,does anybody come across the similar requirement.
    please advise, thanks in advance.
    Regards,
    Babu.

    You could use standard Attachments functionality here ... if the blob is not in FND_LOBS, insert into FND_LOBS, fnd_attached_documents etc to enable viewing via "Attachments" to the entity the blob is related to.
    Gareth

  • How to extract binary data from a File?

    Hello there!
    Hope I'm right here.
    I have a slight problem with a file containing text- and binary-data. At the beginning of the file is only some text followed by some html-code and at the end is some binary stuff like a pdf oder an image (jpg/gif).
    My problem is now how to split these parts and save them in the suitable format. The text and the html are no problem, but I don't know how to extract the binary data. I tried it out with an Inputstream, but I don't know how to find the exact position where the binary data begins.
    Anyone have an idea how I can solve this?
    Thanks in advance and sorry for my bad english.

    I don't believe a bullet-proof solution exists.
    If you know where the HTML ends, you may skip whitespace and then assume the rest is binary data. Or, if you know the first bytes of the binary data, you may locate those. With either of these solutions, though, you risk coming across a file where it doesn't work as expected, for example if the first byte of the binary data happens to match a whitespace character.

Maybe you are looking for

  • What is the easiest way to move all my iPhone photos to an external hard drive?

    How can I manually backup the enormous collection of photos clogging my iPhone 4? Syncing with iTunes sounds like I'd be doing just the opposite -- and actualy adding to my iPhone's image girth. On my laptop, I work primarily with PS Elements, iPhoto

  • What are the keyboard shortcuts to display on external monitor

    Hi how can i get my laptop to export the image to an external monitor? I have a MB Pro, and have tried DVI to HDMI direct cable, the supplied DVI-D cable connected to VGA cable and no luck. the screen on my laptop is flickering and I want to use the

  • Not getting Line Description in Account Analysis Report

    Hi Friends, There is requirement to get line description for account analysis report... Source - Cost Management Category - Receiving Event Type - Receipt into Receiving I have done required setup(Application Accounting Definition) to get the line de

  • Fresh Snow Leopard Installation on new hard drive & Leopard iLife

    I have an early 2009 MBP that came with Leopard 10.5 and upgraded to Snow Leopard. I bought a new hard drive and will need to reinstall OSX. I've read it's possible to perform a fresh install of Snow Leopard without first installing Leopard from the

  • Javafx 1.2 ready for large application?

    I try to use javafx to build a dashboard which may contain 5000 cells, I used Text, ImageView, Stack, HBox, VBox to build this component, which just like Table in HTML. I didnt notice that would be a problem in the begining, when more and more cells