Reading binary columns

I have a generic read routine that works great for every data type I have encountered so far.
But now I want to read a column that is defined as binary(20).
The read code is:
using (SqlDataReader rdr = cmd.ExecuteReader())
int ivalCount = 0;
while ( rdr.Read() )
while (ivalCount < iCount)
ne[ivalCount].Pt_Value = rdr[ivalCount].ToString();
ivalCount++;
The SQL table being read is:
name nvarchar(50) Unchecked
VEC nvarchar(50) Unchecked
stat smallint Checked
lan smallint Checked
unit smallint Checked
flags int Checked
area_offset int Checked
system_offset int Checked
device_offset int Checked
secondary_msg varchar(50) Checked
alarm_flags smallint Checked
pttype nchar(10) Checked
web_message_id varchar(50) Checked
web_point_status nvarchar(50) Checked
sockaddr_in binary(20) Checked
sockaddr_len int Checked
Unchecked
It works great except for the "binary(20)" field.
In MS SQL Server Management Studio, the field appears as:
0x02000400C0A80062000000000000000000000000
But the code that reads the field gets:
"System.Byte[]"
Which strikes me as odd that the return would be the data type.  I sort of half expected a hexAscii string from the "toString"
My main problem is I don't know what data type any field is before reading it.
So what is the "best" way to read in the binary block, store it as hexASCII, not knowing first that it is a binary block?
Recommendations?
Boyd
BDM

Hello,
You can try to use the SqlDataReader.GetDataTypeName method to get the data type of the specify column and then choose difference method to get the data of the column.
Reference:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getdatatypename(v=vs.110).aspx
Regards,
Fanny Liu
If you have any feedback on our support, please click here. 
Fanny Liu
TechNet Community Support

Similar Messages

  • Logical operations on binary columns

    We need to store approx 200 bitfields so we thought we'd use a binary datatype.
    We can set the bit fields easily using
        set bitfield = bitfield  | 1
        set bitfield = bitfield  | 2
        set bitfield = bitfield  | 4
    However we don't want to hard-code these values we like to use a table like this
        update tableA
        set bitfield = bitfield | table.value 
        where ..... table.mask = "MASK1"
    However, it seems there is a limitation where you can only OR/AND a binary datatype with an integer.
    So the column table.value can only go up to 64 bits.
    Why can't we use AND/OR betweem two binary columns ?
    Is there some sort of work around ?
    (Any chance of any changes in ASE ?)
    Incidently MS-SQL suffers the same problem.

    > I think you mixed up bit and binary datatype.
    > Binary datatype is normally used for images, text, storing a pdf in your db, etc
    I'm aware that's what they're usually used for (although I have thought varbinary would have been better)
    but I need to store lots of bit fields and  was hoping I could use a binary datatype, rather than have status1, status2, status3, etc
    > If you want 1 column to store multiple values using bitmasks, than you can use an integer to do that.
    > e.g. see examples in system tables like sysdatabases..status (small int) and sysdatabases..status4 (int)
    That's what we're using at the moment - if fact we're now using unisgned bigint - that gives 64 bits.
    The fact that sys* tables have multiple status fields shows it would be useful here.
    > Sybooks: The bitwise operators are a Transact-SQL extension for use with integer type data.
    > So it looks like you've got to use multiple columns to achieve wat you want.
    Yep - that's exactly what we've found.
    It seems unfortunate to not allow bitwise operations on binary datatypes. Its not a common use of them I know
    but I've worked at couple of places which would have benefited from this.
    We've spent some time writing our own functions that implement bitwise operations on binary fields, but would have been better if these were build in.
    > Why would you want to store 200 bitfields in 1 column?
    For a similar reason as the sys* tables have multiple status columns - If binary columns allowed bitwise operations - they'd only need 1 status field.

  • How can I read a column of numbers saved as .txt and display as a wave?

    Hi Tiano
    LabVIEW General
    Ask:
    Please enter a one-line summary of your question
    Resources
    • Technical Support
    • Development Library
    • Measurement Encyclopedia
    "data/time reading into chart"
    "In the attached file, I am trying to read the first column of data, and the next column is the value on the x-axis I want it plotted at. How do I read two columns of different data? I have looked in the books I have access to and the help within Labview but am still having trouble.
    Thank you,
    Ellie"
    data_set (Plain Text, 3K)
    -posted by Ellie on 9/11/2001
    markwysong on 9/11/2001 answered:
    "Ellie,
    The first thing you need to do is to read your file in as a spreadsheet file. Then, you display it in a chart.
    That sounds simple, but looking at your dataset, there's a few things you should know. First, the "read from spreadsheet VI" is looking for data in columns, like your data set, but columns separated by tabs. Therefore, your data must be saved that way; currently, it doesn't seem that it is. Another thing; you must skip the header portion (labels) of your file when reading.
    Next, it would be easier if your time was first, and your data was second in your columns, but that can be overcome. In the VI I am including, I have copied your data set into a file called data.txt, and I've removed the header and separated the columns with a tab. Then, I read in the data, and I break out each column so I can put the time first, and then I combine them again into a cluster so it can be displayed on an XY chart.
    Take a look!
    Mark"
    Graph data from file (Binary Executable, 20K)
    data.txt (Plain Text, 3K)
    This answer has not yet been rated.
    Rate this answer:
    Mikael Garcia on 9/11/2001 answered:
    "Ellie,
    Here is one way of doing it. Take a look at this example (compatible with LabVIEW 4.1 and up) and post comments if you need further help. Basically, I read your file as text; split it; and make use of the Spread sheet string to Array function before I plot your data. Hope this helps./ Mikael"
    ExtractAndPlot.vi (Binary Executable, 36K)
    This answer has not yet been rated.
    Rate this answer:
    Ellie on 9/12/2001 commented:
    "Thank you. I am trying to get the data from the text file into a string and am having some trouble. I am reading the file from a spreadsheet, and sending the output array to "Array to Spreadsheet String", but I'm not sure this is what I want to do. Is there another way to make an array into a string? Do I need to reformat my data?
    Can you offer me any advice?
    Thank you."
    data_1 (Plain Text, 3K)
    Mikael Garcia on 9/12/2001 commented:
    "I noticed that you changed your file format according to what was said here. Yes, this new file of yours is easier to use but your original file does not have to be changed. Take a look at this example. I now added the file-read part. It will give you a dialog to locate your data file (use this VI with your original file with the header since this VI includes a string split function). Hope this helps. /Mikael"
    ReadExtractandPlot.vi (Binary Executable, 35K)
    Niko on 9/12/2001 answered:
    "If you read this file with the "read from spreadsheet file.vi" you get you
    data in a 2-D-array. Now it is easy with array- and cluster-functions to
    handle the data the way you want.
    hope that helps, Niko"
    This answer has not yet been rated.
    Rate this answer:
    I intend to read from a .txt file that contains a column of numbers. After reading I want to display it as a waveform. In fact the numbers represent points along a waveform/graph of Flow vs. time. Thus I want to have this info in the chart or graph with flow in the y0axis and time in the x-axis. Can someone give me some detailed help please? Thank you in advance.
    Attachments:
    The_file.txt ‏18 KB

    All you have to do is use Read From Spreadsheet File.vi that's on the File I/O palette. For your example .txt, set the Transpose input to true and wire the First Row output to a waveform graph. The only problem I see is that since your file doesn't contain any sampling info, the time axis will be relative. If have that information elsewhere, then you can put a build waveform function between the read and the graph. Wire the First Row output to the Y input Build Waveform and add t0 and dt values. I've attached an example.
    Attachments:
    Graph_from_text.vi ‏29 KB

  • Loader in Python crashes on binary columns (MaxDB 7.6)

    <pre>
    Hi, I currently use MaxDB 7.6.06   Build 003-121-202-135 on Linux and experience severe problems with binary columns and the loader. I do the following (with Python):
    session = sdb.loader.Loader ()
    session.cmd('USE USER XYZ SECURE SERVERDB MYDB ON MYSERVER')
    cmd = "EXPORT COLUMNS * FROM some_binary_table DATA OUTSTREAM 'myfile' FWV BINARY"
    session.release()
    For normal tables without binary columns, this works. However, for tables with binary columns that look like this it crashes:
    CREATE TABLE my_binary_table (
            id INTEGER NOT NULL DEFAULT SERIAL,
            data LONG BYTE NOT NULL,
            PRIMARY KEY (id))
    The output of my script is the following:
    snip -
    EXPORT COLUMNS * FROM my_binary_table DATA OUTSTREAM '/tmp/output.dat' FWV BINARY
    > Emergency stack backtrace <----
    Using 'backtrace' for stack tracing
    (0):0x00007febdc407b30
    (1):0x0000000000720920
    (2):0x00000000007268ce
    (3):0x000000000071eecc
    (4):0x00000000006e4d9c
    (5):0x00000000006e6ee0
    (6):0x00000000006df8a8
    (7):0x00000000004142f1
    (8):0x00007febdb73c436
    (9):0x0000000000413c3a
    > Dump of siginfo contents <----
      signal:      11(SIGSEGV)
      code:        1(ILL_ILLOPC:illegal opcode)
      errno:       0
      value(int):  66(0x42)
      value(ptr):  0x42
      pid:         0
      addr:        (nil)
    > Register Dump <----
      rax: 0x0000000000000000  rbx: 0x0000000000c55ea8
      rcx: 0x0000000000c5a530  rdx: 0x0000000000000003
      rsi: 0x0000000000c55b90  rdi: 0x0000000000a36440
      rsp: 0x00007fffe4c70c10  rbp: 0x0000000000000004
      r08: 0x0000000000a36340  r09: 0x0101010101010101
      r10: 0x0000000000000000  r11: 0x00007febdb79d50e
      r12: 0x0000000000c54c30  r13: 0x0000000000000002
      r14: 0x0000000000c533f2  r15: 0x0000000000000003
      rip: 0x0000000000720920 eflg: 0x0000000000010246
       cs: 0x0000               gs: 0x0000
       fs: 0x0000
    omsk: 0x0000000000000000  cr2: 0x0000000000000000
    trap: 0x000000000000000e  err: 0x0000000000000004
    > Floating-point register dump <----
         foper: 0x0000    frip: 0x0000000000000000  fdata: 0x0000000000000001
       control: 0x0001  status: 0x0000  tag: 0x0000
         mxcsr: 0x0000037f  mxcr_mask: 0x00000000
      fp[0]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[1]: 0x0.1f80 0000 ffff 0000 * 2^0x0000
      fp[2]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[3]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[4]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[5]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[6]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[7]: 0x0.0000 0000 0000 0000 * 2^0x0000
      xmm[00]: 0x00000000.00000000.00000000.00000000
      xmm[01]: 0x00000000.00000000.00000000.00000000
      xmm[02]: 0x00000000.00000000.00000000.00000000
      xmm[03]: 0x00000000.00000000.00000000.00000000
      xmm[04]: 0x00000000.00000000.00000000.00000000
      xmm[05]: 0x00000000.00000000.00000000.00000000
      xmm[06]: 0x00000000.00000000.00000000.00000000
      xmm[07]: 0x00000000.00000000.00000000.00000000
      xmm[08]: 0x00000000.00000000.00000000.00000000
      xmm[09]: 0x00000000.00000000.00000000.00000000
      xmm[10]: 0x00000000.00000000.00000000.00000000
      xmm[11]: 0x00000000.00000000.00000000.00000000
      xmm[12]: 0x00000000.00000000.00000000.00000000
      xmm[13]: 0x00000000.00000000.00000000.00000000
      xmm[14]: 0x00000000.00000000.00000000.00000000
      xmm[15]: 0x00000000.00000000.00000000.00000000
    > Module List <----
    |.text Start       |.text End         | Module File Name
    |0x0000000000400000|0x00000000008e3000| /opt/sdb/programs/pgm/lserver
    |0x00007febdb71e000|0x00007febdb86d000| /lib64/libc-2.8.so
    |0x00007febdba77000|0x00007febdba8d000| /lib64/libgcc_s.so.1
    |0x00007febdbc8e000|0x00007febdbce3000| /lib64/libm-2.8.so
    |0x00007febdbee4000|0x00007febdbfd4000| /usr/lib64/libstdc++.so.6.0.10
    |0x00007febdc1f0000|0x00007febdc1f8000| /lib64/librt-2.8.so
    |0x00007febdc3f9000|0x00007febdc40f000| /lib64/libpthread-2.8.so
    |0x00007febdc615000|0x00007febdc622000| /lib64/libcrypt-2.8.so
    |0x00007febdc852000|0x00007febdc854000| /lib64/libdl-2.8.so
    |0x00007febdca56000|0x00007febdca73000| /lib64/ld-2.8.so
    > Symbolic stack backtrace <----
      0: Lunlock_17 + 0x2f
             SFrame: IP: 0x00007febdc407b30 (0x00007febdc407b01+0x2f)
             Module: /lib64/libpthread-2.8.so
      1: ls27_InitDatExtrRec(tls00_DBInfo, MetaDataDef&, tls00_TransformationCmd*,
    tls00_DextractRec&, char) + 0xa90
             Symbol: Z19ls27InitDatExtrRecP12tls00_DBInfoRP11MetaDataDefP23tls00_T
    ransformationCmdRP17tls00_DextractRecPc
             SFrame: IP: 0x0000000000720920 (0x000000000071fe90+0xa90)
             Module: /opt/sdb/programs/pgm/lserver
      2: ls27ExportTableRows(MetaDataDef&, tls00_DextractRec, char*) + 0xae
             Symbol: Z19ls27ExportTableRowsRP11MetaDataDefP17tls00DextractRecPc
             SFrame: IP: 0x00000000007268ce (0x0000000000726820+0xae)
             Module: /opt/sdb/programs/pgm/lserver
      3: ExportPackageDataRecord(MetaDataDef, tls00_DBInfo, char*) + 0x72c
             Symbol: Z23ExportPackageDataRecordP11MetaDataDefP12tls00DBInfoPc
             SFrame: IP: 0x000000000071eecc (0x000000000071e7a0+0x72c)
             Module: /opt/sdb/programs/pgm/lserver
      4: ExecuteTransformationPackage(tls00_Command, tls00_DBInfo) + 0x2ac
             Symbol: Z28ExecuteTransformationPackageP13tls00CommandP12tls00_DBInfo
             SFrame: IP: 0x00000000006e4d9c (0x00000000006e4af0+0x2ac)
             Module: /opt/sdb/programs/pgm/lserver
      5: ParseExecuteStatement(tls00_Command&, tls00_DBInfo) + 0x550
             Symbol: Z21ParseExecuteStatementRP13tls00CommandP12tls00_DBInfo
             SFrame: IP: 0x00000000006e6ee0 (0x00000000006e6990+0x550)
             Module: /opt/sdb/programs/pgm/lserver
      6: ctrlservcommand + 0x398
             SFrame: IP: 0x00000000006df8a8 (0x00000000006df510+0x398)
             Module: /opt/sdb/programs/pgm/lserver
      7: c_main + 0x451
             SFrame: IP: 0x00000000004142f1 (0x0000000000413ea0+0x451)
             Module: /opt/sdb/programs/pgm/lserver
      8: 0x00007febdb73c436 <symbol name not found>
             SFrame: IP: 0x00007febdb73c436
             Module: /lib64/libc-2.8.so
      9: __gxx_personality_v0@@CXXABI_1.3 + 0xea
             SFrame: IP: 0x0000000000413c3a (0x0000000000413b50+0xea)
             Source: start.S:116
             Module: /opt/sdb/programs/pgm/lserver
    Traceback (most recent call last):
      File "/home/dusty/bin/bsppython", line 142, in ?
        execfile(sys.argv[0])
      File "./dump.py", line 8, in ?
        dump_table_data(metadata)
      File "/home/dusty/prog/bsp/buildout/src/sa_tools/sa_tools/dump/__init__.py", l                                                                            ine 17, in dump_table_data
        dbdump(conn, table.name, FILENAME_PATTERN % (table.name, fn))
      File "/home/dusty/prog/bsp/buildout/src/sa_tools/sa_tools/dump/maxdb.py", line                                                                             37, in dbdump
        session.cmd(cmd)
    loader.CommunicationError: loader.CommunicationError: [1] Reading header from pi                                                                            pe:closed by serve
    ERR -11608 COMMUNIC sql03_request: wrong connection state, state is 'requested'
    snip -
    Any clues about how to get around this?
    Best Regards,
    Hermann Himmelbauer</pre>
    Edited by: Hermann Himmelbauer on Jul 7, 2009 4:54 PM

    Thanks for your hint, but I found another satisfying solution: MaxDB has the the possibility to export all non-binary data to a CSV-File format and export the rest to a specific binary file like that:
    EXPORT COLUMNS * FROM mytable DATA OUTSTREAM 'mytable.csv' LOB OUTSTREAM 2 'mytable.dat'
    This fortunately works now!
    Best Regards,
    Hermann Himmelbauer

  • Why is performance so slow reading binary data from a SQL Azure DB with EF6.x

    I'm running a WPF client that hits a SQL Azure DB using EF 6.x. For the most part, everything seems to be working fine. The one exception is when I try to read a large binary column.
    I am storing files in the DB as a binary column.  When I test using the local DB, everything sings.  When I switch to the Azure DB, I get timeouts when I try to read the file contents.  I have no problem saving the binary data to the DB, just
    reading it.
    I don't know how to troubleshoot this.  I looked at the Query Performance page in the Azure portal, but it doesn't time stamp anything in there and you can't clear it, so I can't correlate what's running with the queries that show up there.
    I tried to start SQL profiler against the DB, but was denied because I'm not a member of the sysadmin fixed server role.
    If I query for the data directly, it comes back quickly.  So this seems to be an Azure via EF issue.
    Any help is appreciated.
    http://digitalcamel.blogspot.com/

    Hi Digital Camel,
    Since I don't know what your scenario is, I won't argue too much about not storing binaries in your SQL DB, but still: don't store binaries in your SQL DB :). The main reason is simple: first and foremost, in both the current and future pricing tier your
    levels are defines on the size of the DB. Basically, you pay way more by storing your binaries on your SQL layer rathern than storing them elsewhere, such as Azure Storage. Second, the protocol your binaries would be downloaded over the wire is prone to network
    connectivity issues: you could use HTTP(S) or FTP instead, if you'd use Azure Storage. Last but not least, when you download the binary from your DB, you keep a connection open which in the end is a connection other users might have used to query data instead.
    However, in regard to your question, how did you "query for the data directly"? Did you try to query the data using SSMS with the Client Statistics option on? This could tell you if the problem is network, server or client related.
    Hope this helps!
    Alex

  • 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

  • Read only column in tabular form

    There is a not null column ( say SEQ) in a tabular form that is getting an auto value from other process. 2 more columns need user input on each row.I need to make this column(SEQ) as read only.
    If I make this column (SEQ) as standard report column then when I submit the newly added row , I always get ORA-20001 error- can not insert NULL into SEQ.. even though I can see there is a value there. Switch ithe column back to text field, the insert went just fine .
    How do you solve this read only column issue ?
    Thanks a bunch for your help.
    Tai

    thank you for your reply.
    Nope, SEQ is not the first column. Primary Key is and I leave the pK alone.
    When I press ADDROW button , tabular form is like the following: ( table alreay has 2 rows), I auto populate SEQ column and I like to make this SEQ column display only.
    -- represents checkbox
    PK      SEQ      col1           col2
    --     1     890          test1
    --     2     675          test2
    --     3     

  • How to open and read binary files?

    How do I open and read Binary files?

    Did you  look on The Unarchiver's web site where it has a link to older versions? http://theunarchiver.googlecode.com/files/TheUnarchiver3.2_legacy.zip
    The best thing to do is ask your friends what programs they used to produce these files, or at least what format files they are producing.  Otherwise it's like being shown a car and given a bundle of 200 keys with no idea to which one to use, or even if any of them work with that car.
    Using The Unarchiver will likely not do anything because it too will not know what format files are involved, and they may not even been in an archived format.  If they sent you a Word file without telling you (a favorite of Windows users to do  -- it drives me crazy when they could have just sent them in plain text), The Unarchiver won't open them.  If it's a picture file then using Hexedit will just show you a bunch of unintelligible stuff as shown in an earlier post, though you may see a line of text providing a hint.
    As I said earlier, often .bin may be an executable program which needs another program to actually interpret it.  That's what Java is trying to do.  Still, it may think it can execute the file, but it is highly unlikely somebody would send you an executable program (and if they did I would not trust it).  For all you know it may be a Windows virus.

  • How to read the column name of a table from sap system using C#?

    Hi!!
    I am using SAP .NET connector and creating a windows application.
    Now I wanna read the column name when a table name is given....
    Connection is done, but I don't know the code to read the column names alone...
    Can anyone help me with the code??

    fine!!
    So if i give the table name, which the RFC_READ_TABLE function module have, will it run properly? or i wanna change all the codes in order to support RFC_READ_TABLE function module?
    Because from the beginning I was using BAPI_CUSTOMER_GETLIST function, but my client requirement is to use ERP function module RFC_READ_TABLE, he didn't give any table name also..
    This is my code: What I have to change in this???
    ECCDestinationConfig ECCDestination = new ECCDestinationConfig();
                RfcDestinationManager.RegisterDestinationConfiguration(ECCDestination);
                RfcDestination rfcDest = null;
                rfcDest = RfcDestinationManager.GetDestination(a);
                    RfcRepository repo = rfcDest.Repository;
                    IRfcFunction customerList = repo.CreateFunction("BAPI_CUSTOMER_GETLIST");
                    IRfcTable addressData = customerList.GetTable("AddressTable"));
                    int j = addressData.Metadata.LineType.FieldCount;
                    for (int i = 0; i < j; i++)
                        RfcElementMetadata metadata = addressData.GetElementMetadata(i);
                        listallcolumn.Items.Add(metadata.Name);
    Message was edited by: Jeswin Rebil

  • 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?

  • Labview 8.2 Read Binary File, no pos offset option anymore?!

    I have a VI that worked perfectly well in 7.1 and now I've opened it in 8.2 it doesn't work and I can't revert back to 7.1 because I accidently pressed save.
    In 7.1 I used the combination of open, read and close file functions to read parts of a large binary data file - I cannot read the whole file into Labview 8.2 as it fills the memory. There isn't a terminal in the 'read binary file' function in 8.2 for 'pos offset' which is what I used to use in 7.1. How am I supposed to open the file now? Surely they have not removed such a useful facility entirely - is there another way to do it that I am not aware of?
    Many thanks in advance for help,
    Sarah

    smercurio_fc wrote:
    André, at first I could not understand your response, ...
    Must be my Dutch way of writing English
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Read binary file in LabVIEW 2012

    Hi,
    Have anyoune experienced problems reading binary files in 2012 previously saved in 2010.
    As shown on attached image, the same VI is opened in 2010 and 2012 reading the same binary file containing the data structure "ProcessList IN".
    I suspect it has something to do with the variants ?
    The error message does help a lot (-;
    Any ideas ?
    Kind regards
    Kahr
    Regards Kahr
    Certified LabVIEW Architect
    CIM A/S
    Attachments:
    Read_Binary_File_Error_LV2012.png ‏426 KB

    Hi Kahr,
    "error 1" tells one of the input parameters is wrong: it's either the path or the cluster datatype! The error message only mentions a file path AS AN EXAMPLE!
    You're using BinaryRead similar to those old Datalog file functions to read a cluster of several data. It has been know that datalog files get tricky when one is using a different LabVIEW version to read them due to changes of internal data representation. Maybe that's the point that hits you now?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Script task to read the column names dynamically and create a table in database based on excel column structure

    Hello,
    Can anyone help me out to write a vb.net script.
    I need to read the column names from excel and based on that column names I need to create a table in database(I have more than one sheet in excel).
    For each sheet columns will be changing and should create a table dynamically for each sheet.
    Any help would be appreciated.

    Refer the below script to read columns in each sheet.
    Dim excelfile As String = Dts.Variables("ExcelPath").Value.ToString
    Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + excelfile + ";Extended Properties=Excel 8.0"
    Dim oledbcon As New OleDb.OleDbConnection(connectionstring)
    oledbcon.Open()
    Dim dt As DataTable
    Dim schemaTable As DataTable
    Dim OLEDBCMD As New OleDb.OleDbCommand
    Dim oledbdatareader As OleDb.OleDbDataReader
    Dim columns As String = ""
    dt = oledbcon.GetSchema("Tables")
    Dim TABCOMMAND(20) As String
    Dim TABCOUNT As Integer = 0
    For Each row As DataRow In dt.Rows
    TABCOMMAND(TABCOUNT) = "SELECT * FROM [" & row.Item("TABLE_NAME").ToString & "]"
    OLEDBCMD.CommandText = TABCOMMAND(TABCOUNT)
    OLEDBCMD.Connection = oledbcon
    oledbdatareader = OLEDBCMD.ExecuteReader(CommandBehavior.KeyInfo)
    schemaTable = oledbdatareader.GetSchemaTable()
    For Each myfield As DataRow In schemaTable.Rows
    For Each myproperty As DataColumn In schemaTable.Columns
    If myproperty.ColumnName = "ColumnName" Then
    columns = columns & myfield(myproperty).ToString & ","
    MsgBox(myfield(myproperty).ToString)
    End If
    Next
    Next
    oledbdatareader.Close()
    OLEDBCMD.Dispose()
    Next
    oledbcon.Close()
    Regards, RSingh

  • 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)

  • Reg: read excel column and insert into table.

    hi Friends,
          i wanted to read the data from Excel and insert into in my oracle tables.
          can you provide the link or example script.
        how to read the column value from excel and insert into table.
      please help.

    < unnecessary reference to personal blog removed by moderator >
    Here are the steps:
    1) First create a directory and grant read , write , execute to the user from where you want to access the flat files and load it.
    2) Write a generic function to load PIPE delimited flat files:
    CREATE OR REPLACE FUNCTION TABLE_LOAD ( p_table in varchar2,
    p_dir in varchar2 DEFAULT ‘YOUR_DIRECTORY_NAME’,
    P_FILENAME in varchar2,
    p_ignore_headerlines IN INTEGER DEFAULT 1,
    p_delimiter in varchar2 default ‘|’,
    p_optional_enclosed in varchar2 default ‘”‘ )
    return number
    is
    – FUNCTION TABLE_LOAD
    – PURPOSE: Load the flat files i.e. only text files to Oracle
    – tables.
    – This is a generic function which can be used for
    – importing any text flat files to oracle database.
    – PARAMETERS:
    – P_TABLE
    – Pass name of the table for which import has to be done.
    – P_DIR
    – Name of the directory where the file is been placed.
    – Note: The grant has to be given for the user to the directory
    – before executing the function
    – P_FILENAME
    – The name of the flat file(a text file)
    – P_IGNORE_HEADERLINES
    – By default we are passing 1 to skip the first line of the file
    – which are headers on the Flat files.
    – P_DELIMITER
    – Dafault “|” pipe is been passed.
    – P_OPTIONAL_ENCLOSED
    – Optionally enclosed by ‘ ” ‘ are been ignored.
    – AUTHOR:
    – Slobaray
    l_input utl_file.file_type;
    l_theCursor integer default dbms_sql.open_cursor;
    l_lastLine varchar2(4000);
    l_cnames varchar2(4000);
    l_bindvars varchar2(4000);
    l_status integer;
    l_cnt number default 0;
    l_rowCount number default 0;
    l_sep char(1) default NULL;
    L_ERRMSG varchar2(4000);
    V_EOF BOOLEAN := false;
    begin
    l_cnt := 1;
    for TAB_COLUMNS in (
    select column_name, data_type from user_tab_columns where table_name=p_table order by column_id
    ) loop
    l_cnames := l_cnames || tab_columns.column_name || ‘,’;
    l_bindvars := l_bindvars || case when tab_columns.data_type in (‘DATE’, ‘TIMESTAMP(6)’) then ‘to_date(:b’ || l_cnt || ‘,”YYYY-MM-DD HH24:MI:SS”),’ else ‘:b’|| l_cnt || ‘,’ end;
    l_cnt := l_cnt + 1;
    end loop;
    l_cnames := rtrim(l_cnames,’,');
    L_BINDVARS := RTRIM(L_BINDVARS,’,');
    L_INPUT := UTL_FILE.FOPEN( P_DIR, P_FILENAME, ‘r’ );
    IF p_ignore_headerlines > 0
    THEN
    BEGIN
    FOR i IN 1 .. p_ignore_headerlines
    LOOP
    UTL_FILE.get_line(l_input, l_lastLine);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_eof := TRUE;
    end;
    END IF;
    if not v_eof then
    dbms_sql.parse( l_theCursor, ‘insert into ‘ || p_table || ‘(‘ || l_cnames || ‘) values (‘ || l_bindvars || ‘)’, dbms_sql.native );
    loop
    begin
    utl_file.get_line( l_input, l_lastLine );
    exception
    when NO_DATA_FOUND then
    exit;
    end;
    if length(l_lastLine) > 0 then
    for i in 1 .. l_cnt-1
    LOOP
    dbms_sql.bind_variable( l_theCursor, ‘:b’||i,
    ltrim(rtrim(rtrim(
    regexp_substr(l_lastLine,’([^|]*)(\||$)’,1,i),p_delimiter),p_optional_enclosed),p_optional_enclosed));
    end loop;
    begin
    l_status := dbms_sql.execute(l_theCursor);
    l_rowCount := l_rowCount + 1;
    exception
    when OTHERS then
    L_ERRMSG := SQLERRM;
    insert into BADLOG ( TABLE_NAME, ERRM, data, ERROR_DATE )
    values ( P_TABLE,l_errmsg, l_lastLine ,systimestamp );
    end;
    end if;
    end loop;
    dbms_sql.close_cursor(l_theCursor);
    utl_file.fclose( l_input );
    commit;
    end if;
    insert into IMPORT_HIST (FILENAME,TABLE_NAME,NUM_OF_REC,IMPORT_DATE)
    values ( P_FILENAME, P_TABLE,l_rowCount,sysdate );
    UTL_FILE.FRENAME(
    P_DIR,
    P_FILENAME,
    P_DIR,
    REPLACE(P_FILENAME,
    ‘.txt’,
    ‘_’ || TO_CHAR(SYSDATE, ‘DD_MON_RRRR_HH24_MI_SS_AM’) || ‘.txt’
    commit;
    RETURN L_ROWCOUNT;
    end TABLE_LOAD;
    Note: when you run the function then it will also modify the source flat file with timestamp , so that we can have the track like which file was loaded .
    3) Check if the user is having UTL_FILE privileges or not :
    SQL> SELECT OWNER,
    OBJECT_TYPE
    FROM ALL_OBJECTS
    WHERE OBJECT_NAME = ‘UTL_FILE’
    AND OWNER =<>;
    If the user is not having the privileges then grant “UTL_FILE” to user from SYS user:
    SQL> GRANT EXECUTE ON UTL_FILE TO <>;
    4) In the function I have used two tables like:
    import_hist table and badlog table to track the history of the load and another to check the bad log if it occurs while doing the load .
    Under the same user create an error log table to log the error out records while doing the import:
    SQL> CREATE TABLE badlog
    errm VARCHAR2(4000),
    data VARCHAR2(4000) ,
    error_date TIMESTAMP
    Under the same user create Load history table to log the details of the file and tables that are imported with a track of records loaded:
    SQL> create table IMPORT_HIST
    FILENAME varchar2(200),
    TABLE_NAME varchar2(200),
    NUM_OF_REC number,
    IMPORT_DATE DATE
    5) Finally run the PLSQL block and check if it is loading properly or not if not then check the badlog:
    Execute the PLSQL block to import the data from the USER:
    SQL> declare
    P_TABLE varchar2(200):=<>;
    P_DIR varchar2(200):=<>;
    P_FILENAME VARCHAR2(200):=<>;
    v_Return NUMBER;
    BEGIN
    v_Return := TABLE_LOAD(
    P_TABLE => P_TABLE,
    P_DIR => P_DIR,
    P_FILENAME => P_FILENAME,
    P_IGNORE_HEADERLINES => P_IGNORE_HEADERLINES,
    P_DELIMITER => P_DELIMITER,
    P_OPTIONAL_ENCLOSED => P_OPTIONAL_ENCLOSED
    DBMS_OUTPUT.PUT_LINE(‘v_Return = ‘ || v_Return);
    end;
    6) Once the PLSQL block is been executed then check for any error log table and also the target table if the records are been successfully imported or not.

Maybe you are looking for

  • SQL error 3113 occurred when executing EXEC SQL.

    Hi, We are facing one typical problem, One background is failing regularly with below dump. as we now got all notes giving information, if database  restarted taking backup, these type of failures occur, but our database is only down for backup once

  • How to change display name in iMessage?

    My son has an iPod that's using iMessage to text. When he text to my phone, it has my name as the display name and not his.  How can I change this so it can display his name instead of mine?  I am using my iCloud account on this iPod, not sure if it

  • How To Setup My ITunes Library

    Hi, I have ripped and stored some songs from my CD collections. But my iMac brock down and I still haven't  finished ripping the CDs. So aftering sending my iMac to repare, "how do I set up my (NEW) ITunes Library. So that I can continue rippng the s

  • 0hr_PT_3: No Data comes up

    Hey @ll BW Gurus, i have a problem with the datasource 0hr_PT_3! In my testsystem this datasource runs without any errors...but there are missing data concerning the vacation contingents in my productivesystem. With the rsa3 I get the right data, but

  • Cross-component: Call method of using component from within used component?

    Hi, I began diving into cross-component programming. Meanwhile after having digged into some scenarios some questions came up to my mind that I am not able to answer myself. I would appreciate your help here! Say we have to components.  Comp A uses C