Blob, SaveToStream and DBExpress

josepieds
2006-01-09
2013-05-01
  • josepieds
    josepieds
    2006-01-09

    I try to save a document (test.doc) in a blobField on my DB2 server and recover this document to my PC and i have a problem. 

    If the length of the document is equal or least to 40959 bytes, it's ok.  But if the file is greater or equal to 40960 bytes, it will be impossible for me to open this file after save it.

    I try with a ASCII file (test.txt) and i compare the source and result file with ARAXIS MERGE, and i see than the character # 40960 is deleted in the result file and some others characters are deleted (3 others characters after the byte 40960). 

    I could send the source and result file by email.

    I try with BDE and it's ok !

    Someone can help me ?

     
    • josepieds
      josepieds
      2006-01-10

      I see that it's always the 40960 byte which is lost.

      If the file contains 81920 bytes, 2 characters are lost.

      Can that help somebody?

       
    • What version at you dbxoodbc.dll or DbxOpenOdbc.pas? Reading BLOB is made in procedure TSqlCursorOdbc. FetchLongData.

       
    • josepieds
      josepieds
      2006-01-10

      dbxodbc.dll v 3.0.2.3

       
    • The latest version is 3.024

      Try these versions.

      Release binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Release/dbxoodbc.dll.zip

      Debug binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Debug/dbxoodbc.dll.zip

      40959 - it corresponds{meets} to parameter of connection coBlobChunkSize=40960

      At you the mistake occurs at transition of border of coBlobChunkSize. I could not repeat your mistake. Send me your example...

       
    • josepieds
      josepieds
      2006-01-10

      The link is erroneous ? I am unable to download the file. Does *checkout* in the link correspond to something ?

       
    • It should be as is accessible in CVS. In cvs you can go with summary project page... Look Browse cvs...

      Today could not get in CVS. I think it is connected with holidays...

      I can send you by mail... Communicate through a mail...

       
    • josepieds
      josepieds
      2006-01-10

      I sent to you a email through the site sourceforge.net.

       
    • josepieds
      josepieds
      2006-01-10

      When I receive a email from you, I will send to you by email a small test program which I made with the connection string that I use and the table script for which I test to upload and download the .doc file in question.

      Thank !

       
    • Fixed in version DbxOODBC 3.025.

      Changes:

      + Added support Delphi 2006 Win32 DBX Driver version 2.5 (Ansi Driver).
      + ReAllocation of memory at reading BLOBS is excluded (BLOB fragmentation mode).
        Connection option "coBlobFragmntns" (default is on).
        For detail see method "TSqlCursorOdbc.FetchLongData" .
      + Fixed: Fetcn BLOB binary and WideChar data (method "TSqlCursorOdbc.FetchLongData").
      + Processing of an option eConnNativeHandle is changed. For access to interface ISqlConnectionOdbc now it is
        necessary to use this option. Example:
        var
          iLen : Smallint;
          Status: SQLResult;
          fSqlConOdbcIntf: ISqlConnectionOdbc;
        begin
          Status := SQLConnection1.SQLConnection.getOption(eConnNativeHandle, Pointer(@fSqlConOdbcIntf), SizeOf(Pointer), iLen);
          if (Status = 0) and (fSqlConOdbcIntf <> nil) then
          begin
            Caption := Caption. + ' "' +fSqlConOdbcIntf.GetDbmsName + '", version: '+
            Format('%d.%d.%d.%d. DirectOdbc=%s. OdcLevel=%d. TransactSup=%s', [
              fSqlConOdbcIntf.GetDbmsVersionMajor,
              fSqlConOdbcIntf.GetDbmsVersionMinor,
              fSqlConOdbcIntf.GetDbmsVersionRelease,
              fSqlConOdbcIntf.GetDbmsVersionBuild,
              cBool[not fSqlConOdbcIntf.GetIsSystemODBCManager()],
              fSqlConOdbcIntf.GetOdbcDriverLevel(),
              cBool[SQLConnection1.TransactionsSupported]
              ]);
      + NEW UNIVERSAL dbxoodbc connection method. Solved problem when DATABASENAME_KEY is more 255 chars.
        (Use CONNECTION_STRING is accessible for Unicode DBX drivers).
        ...
        uses ..., SqlConst, DbxOpenOdbcInterface;
        ...
        MyConnectionString := 'Database=DRIVER={Microsoft Paradox Driver (*.db )};DefaultDir=E:\BORLAND\BORLAND SHARED\DATA\PDX5;DriverId=538;FIL=Paradox 5.X;MaxBufferSize=2048;PageTimeout=17;coLockMode=-1';
        SQLConnection1.Params.Values[CUSTOM_INFO] := cConnectionOptionsNames[coConnectionString] + '=' + MyConnectionString;
        SQLConnection1.Params.Values[DATABASENAME_KEY] := '?'; // '?' == ignored value when CONNECTION_STRING is defined.
        ...
        SQLConnection1.Connect;

        or
        ...
        MyConnectionString := ...
        SQLConnection1.Params.Values['Custom String'] := 'coConnectionString=' + MyConnectionString;
        SQLConnection1.Params.Values['Database'] := '?';
        ...

      + Some files (*.7z) are packed by archiver "7-Zip":
        http://www.7-zip.org
        http://sourceforge.net/projects/sevenzip/

      + Processing of defects in Delpgi 2006 is added at installation of parameters of connection
        "eConnCustomInfo", "eConnDecimalSeparator"  for Ansi drivers.
        Instead of call SetStringOption it is used SetOption (see "TSqlConnectionOdbc.SetOption"):
          FISQLConnection.SetOption(eConnCustomInfo, ...
          FISQLConnection.SetOption(eConnDecimalSeparator, ...

      Links:

      Release binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Release/dbxoodbc.dll.zip

      Debug binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Debug/dbxoodbc.dll.zip

      Readme (download instruction):
        http://cvs.sourceforge.net/viewcvs.py/open-dbexpress/dbxoodbc/ReadMe.Txt?view=markup

      Changes Log:
        http://cvs.sourceforge.net/viewcvs.py/open-dbexpress/dbxoodbc/ChangesLog.Txt?view=markup

      Project Sources (Browse CVS):
        http://cvs.sourceforge.net/viewcvs.py/open-dbexpress/dbxoodbc/

       
    • Some links fixed:

      Release binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Release/dbxoodbc.dll.rel.7z

      Debug binary (zip):
        http://cvs.sourceforge.net/viewcvs.py/\*checkout*/open-dbexpress/dbxoodbc/_Debug/dbxoodbc.dll.dbg.7z