Can't read special characters in an excel file using JDBC

Hi! I 've a code to read an excel file using JDBC-ODBC bridge. I can read the values, but any special characters is readed wrong, just symbols. The special characters are of spanish language. This is my code:
                Locale currentLocale;
          currentLocale = new Locale("es", "MX");
          Locale.setDefault(currentLocale);
               Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
               c = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=comisionesperfiles.xls");
               stmnt = c.createStatement();
               String query = "Select * from [Hoja1$]" ;
               ResultSet rs = stmnt.executeQuery( query );
               while( rs.next() ){
                    String valor = rs.getString(2) ;
                    if(valor != null && !"null".equalsIgnoreCase(valor)){
                         if(!comisiones.contains(valor)){
                              System.out.println(valor);
                              comisiones.add( valor );
               rs.close();
               stmnt.close();As you can see, I've tried to set the locale, but it didn't work.
I'm using Excel 2003, Java Version 1.4.2_07 and Windows XP Professional (in latin american spanish).
Hope someone can help me!

FYI: Apache's POI can read/write Excel files in Java:
http://jakarta.apache.org/poi/index.html

Similar Messages

  • Removing non printable characters from an excel file using powershell

    Hello,
    anyone know how to remove non printable characters from an excel file using powershell?
    thanks,
    jose.

    To add - Excel is a binary file.  It cannot be managed via external methods easily.  You can write a macro that can do this.  Post in the Excel forum and explain what you are seeing and get the MVPs there to show you how to use the macro facility
    to edit cells.  Outside of cell text "unprintable" characters are a normal part of Excel.
    ¯\_(ツ)_/¯

  • How can i Read the Data from such Excel files?

    Dear All,
            Here I am attaching an excel file in which all the datat cells have more than one data, can anybody tell me, how to read from such kind of excel files?
    Thanks in Advance & Happy New Year,
    Rujuta

    Greetings Ruju,
    Here is what I do to read such a file:
    I first save the Excel file (xls) as CSV file (which is easier to handle: Comma Seperated Values) .. Open the file using Excel and save it CSV.
    Then using the code attached I get all these values in a string array.
    Hope this helps
    Ayman Mohammad Metwally
    Automation Engineer
    Egypt - Cairo
    Attachments:
    CSV2ARRAY.vi ‏29 KB

  • Reading special characters from a flat file and inserting into DB

    I'm reading data with special characters like . etc from a flat file , assigning the data to variable in my anonymous block and inserting into my DB. But the show up as inverted ? s. Any clues about how to do this?
    If i try to do the insert directly it works. It seems like the error occurs when reading this data into a variable
    thanks for the help
    Lalit Bhatia

    lalit, this is probably an character set problem, the default on Database creation tends to be 7bit Ascii which does not support special characters, it's been a while since I set up a db in this way, but you need to change settings in oracle.ini. The db will need to be restarted for this. Also, to check current settings try:
    select * from NLS_DATABASE_PARAMETERS
    You want an 8bit, unicode or multibyte character set. Sorry I cannot remember moer off the top of my head, try searching on NLS or character set

  • XSL-FO unable to read special characters from the XML file

    Team,
    please help on issue, when trying to read the text from XML file (Special characters like bullet). It is displaying as Question mark(?) in output in place of bullet..please proved any soultion.

    The "?" signals a character set mismatch issue - http://www.oracle.com/technetwork/database/globalization/nls-lang-099431.html - between client and database software

  • How to read the content of this excel file in LV

    Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
    Thanks
    The excel file is attached
    Attachments:
    Datalogging.zip ‏307 KB

    Check attached VI.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    ReadFromExcel.vi ‏27 KB

  • How to run Excel Macros using JDBC-ODBC

    Hi,
    I want to run the excel macros in the excel file, after I connected to excel file, using JDBC-ODBC bridge.
    How macros treated here?
    Help needed please..........
    - Ramesh

    How to run Excel Macros using JDBC-ODBCYou don't.
    As my fuzzy understanding goes.....
    Macros (excel, word, etc) run via a "OLE" extension of the script host system.
    So the only way to run them is via the OLE interface. That has nothing to do with ODBC. You can write your own JNI to do that, or you might get lucky and find that someone else has written a java library to do it for you.

  • How to read a table from a word file, using HWPF

    How can I read a table from a Word file using HWPF?
    I looked in API and Table class doesn't seem to have a constructor... very very strange for me. pls help

    the constructor is HWPFDocument = new HWPFDocument(/*file*/)
    Here is the API for that
    http://poi.apache.org/apidocs/org/apache/poi/hwpf/HWPFDocument.html
    Also here is another link to something that might help you more with tables
    http://www.aspose.com/Community/forums/thread/79182.aspx

  • How can I display special characters of NonEuropean languages (French, Italian, Spanish, German and Portuguese.) using import string mechanism

    I would like to translate the User Interface of my application to French, Italian, Spanish, German and Portuguese.
    When I put special characters in the import string file they showed up as ? (question mark)
    The import strings file includes the following parameters for each string: font, text, size and style. (but no field for script)
    In order to use a unicode font such as Arial I need to select a french script. But this option is not supported bu LabView (As far as I saw)
    A) Is there a font which is directly German/ French etc and not regula font + script parameter?
    B) Are there another required step
    s for special characters support? (When I put speciual characters in the import string file the showed up as ? question mark)

    This was discussed last week in this group- read the previous messages.
    Look for the thread "Foreign Languages in Labview"
    And recite the mantra
    ActiveX is good
    ActiveX is holy
    All Hail Bill
    Those who claim otherwise are heretics and not to be trusted
    Actually, in this case the non-ActiveX suggestions may be good.
    talia wrote in message
    news:[email protected]..
    > How can I display special characters of NonEuropean languages (French,
    > Italian, Spanish, German and Portuguese.) using import string
    > mechanism

  • How can I distinguish special characters or signs in Doc through VBA?

    How can I distinguish special characters or signs in Doc through VBA?
    I have a few large documents written in word 2003 format and now I work on them under word 2007.
    Such large documents containing lots of special characters.  I want to change them into Microsoft 3.0 equation form(It is required by the team). I find no way but using function AddOLEObject and  Sendkeys through VBA. Common characters can be added
    to equation by function Sendkeys, but the return value of Asc() or AscW() for "double arrow", "in" , " not greater than " such special characters or signs, to name but a few are the same ,i.e., 40 And I cannot distinguish them.
    I found the link http://msdn.itags.org/word/44333/ may be of use to me, and the title is:
    How to read symbols from a DOC documents! (Microsoft Word)
     the original question is
    Using function "InsertSymbol", I can insert a symbol into a document. But
    how can I read a symbol from a document?
    Using "Characters(i).range.text", I can read a char. But when meeting a
    symbol, the value of "Characters(i).range.text" is always '('.How can I get the CharacterNumber of the symbol.
    And the final answer is :
    Hi chenfeng,
    Word protects symbols from symbol fonts if you insert them from the "Insert
    > Symbol" dialog.
    This is done so they aren't changed when you change the font or style. But
    it also results in Word reporting AscW( ) = 40 on all of them.
    I've posted a macro to "unprotect" them (or to protect them again if you
    want) ... just today again in
    Newsgroups: microsoft.public.word.vba.customization
    Subject: Symbol Characters
    Date: Mon, 3 May 2004 11:00:46 -0700
    Message-ID: <09f401c43138$8f92f900$[email protected]>
    It isn't archived on Google yet, but tomorrow you should be able to simply
    copy the message ID into http://www.google.com/advanced_group_search.
    Regards,
    Klaus
    But the link for the macro in the final answer is missing.
    Can anyone with kindness help me? Thaks a lot.

    Following Cindy Meister's Advice ,I use MathType SDK.
    The sample in MathType SDK in the following may be meaningful,but I do not know how the MTEF for cos^^2Theta, MTEF for sin^^2Theta and MTEF for 1 are generated .
    It looks much complicated,and I searched the docs in MathType SDK to get a explanation.Is there any function to generate them? I want to use this method to change commaon text mathematical signs( in special character table) and  Greek letters and characters
    with subscripts and superscripts to Microsoft 3.0 equation form.
    Can anyone with kindness help me?
    Sub MTEFTextSubstitution()
        Dim MTEFStr1$, MTEFStr2$, MTEFStr3$
        Dim stat
        'MTEF for cos^^2Theta
        MTEFStr1$ = "% MathType!MTEF!2!1!+-" + _
            " % feaaeaart1ev0aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn" + _
            " % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr" + _
            " % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9" + _
            " % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x" + _
            " % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaci4yaiaac+" + _
            " % gacaGGZbWaaWbaaSqabeaacaaIYaaaaOGaeqiUdehaaa!3B65!"
        'MTEF for sin^^2Theta
        MTEFStr2$ = "% MathType!MTEF!2!1!+-" + _
            " % feaaeaart1ev0aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn" + _
            " % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr" + _
            " % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9" + _
            " % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x" + _
            " % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaci4CaiaacM" + _
            " % gacaGGUbWaaWbaaSqabeaacaaIYaaaaOGaeqiUdehaaa!3B6A!"
        'MTEF for 1
        MTEFStr3$ = "% MathType!MTEF!2!1!+-" + _
            " % feaaeaart1ev0aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn" + _
            " % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr" + _
            " % 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9" + _
            " % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x" + _
            " % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaaGymaaaa!36A4!"
        Selection.Copy
        'Init API, reset transform
    '    If MTUtil.CheckMTDLLVersion = 0 Then Exit Sub
        If Not IsDLLVersionOK() Then Exit Sub
        MTXFormReset
        'first substitution
        stat = MTXFormAddVarSub( _
            mtxfmSUBST_ONE, _
            mtxfmVAR_SUB_PLAIN_TEXT, "<v1>", 0, _
            mtxfmVAR_SUB_MTEF_TEXT, MTEFStr1$, Len(MTEFStr1$), 0)
        If stat <> 0 Then
            MsgBox "1st MTXFormAddVarSub returned: " + Str(stat)
            Exit Sub
        End If
        'second substitution
        stat = MTXFormAddVarSub( _
            mtxfmSUBST_ONE, _
            mtxfmVAR_SUB_PLAIN_TEXT, "<v2>", 0, _
            mtxfmVAR_SUB_MTEF_TEXT, MTEFStr2$, Len(MTEFStr2$), 0)
        If stat <> 0 Then
            MsgBox "2nd MTXFormAddVarSub returned: " + Str(stat)
            Exit Sub
        End If
        'third substitution
        stat = MTXFormAddVarSub( _
            mtxfmSUBST_ONE, _
            mtxfmVAR_SUB_PLAIN_TEXT, "<v3>", 0, _
            mtxfmVAR_SUB_MTEF_TEXT, MTEFStr3$, Len(MTEFStr3$), 0)
        If stat <> 0 Then
            MsgBox "3rd MTXFormAddVarSub returned: " + Str(stat)
            Exit Sub
        End If
        'do the substitution
        stat = TransformGraphicEquation
        If stat <> 0 Then
            MsgBox "TransformGraphicEquation returned: " + Str(stat)
            Exit Sub
        End If
        MTTermAPI
        'Paste new equation
        Selection.Collapse Direction:=wdCollapseEnd
        Selection.PasteSpecial Placement:=wdInLine
    End Sub

  • Can't open "special characters" in any Edit menu; have a constantly flashing empty window labelled 'characters' that i can't stop. window flashes then disappears every time i click on anything.  any suggestions? tru thanx !

    i can't open "special characters" in any Edit pull down menu.  i have a constantly flashing empty window labelled 'characters' that i haven't been able to stop.
    it appears every time i click on anything.  any suggestions?  tru thanx

    I, too, have found Bridge very unstable. I find this to be extremely disappointing, seeing as it's literally the most expensive piece of software I've ever purchased for personal use. I've seen these two symptoms:
    1. When running in full screen mode, Bridge crashes periodically. This happened on Vista, so I blamed Vista (of course), but even after regressing to XP SP2, I see the same symptoms.
    2. Although I didn't see this on Vista, running on XP I see the problem described earlier in this thread, where clicking on a thumbnail displays the wrong image preview. When this happens the image displayed is one from a different folder! I solve the problem by clearing the cache, and it's OK for a while, but the problem keeps returning.
    3. Even when exiting cleanly from Bridge (using File->Exit), Bridge often forgets where I was working in my previous session. I need to re-navigate from the very top level directory down through the hierarchy to my photo directory.
    Again, it's very disappointing to invest so much in a single software package only to see such basic operations malfunction.

  • Problem in reading special characters

    Hi friends
    I am doing one program which read serial port data (for bar code reader) using java application.
    My program is working well and reading serial data but it is not displaying special characters.When i read through hyperterminal i can see all special characters but when see data throught the output of java program these special characters are missing...
    I don't know i am doing something wrong in stream or ???
    My code is
    [CODE]public void serialEvent(SerialPortEvent event) {
              System.out.println("before serialEvent");
              StringBuffer readBuffer1 = new StringBuffer();
              switch (event.getEventType()) {
              case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                   System.out.println("Data empty:");
                   break;
              case SerialPortEvent.DATA_AVAILABLE:
                      byte[] readBuffer = new byte[100];
                      int r = 0;
                      try {
                           System.out.print("test"); 
                          //t inputStream = serialPort.getInputStream();
                         while((r = inputStream.read(readBuffer)) != -1) {
                            System.out.print(new String(readBuffer, 0, r));
                      } catch (Exception e) {
                         e.printStackTrace(System.out);
    }[/CODE]Please help

    Hi DrClap,
    Thanks for your reply.
    That article was helpful in understanding character conversions. And it works fine for JSPs.
    But when I tried to apply the same in JSF it does not work. May be this is not the right forum to dicuss JSF related things. But if you know how pageEncoding and contentType can be mentioned in JSF. I am using myfaces and I have tried <h:form id="SearchForm" acceptCharset="UTF-8" accept="text/html;charset=UTF-8">. Didnt work....

  • How can I create an csv/excel file using pl/sql and then sending that file

    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.

    968776 wrote:
    How can I create an csv/excel file using pl/sql and then sending that file to a clients site using pl/sql?
    I know how to create the csv/excel file but I can't figure out how I would get it to the clients site.You are trying to do it at a wrong place..
    Whay do you want database (pl/sql) code to do these things?
    Anyhow, you may be interested in :
    {message:id=9360007}
    {message:id=9984244}

  • Read a Column from an Excel file

    Guys,
    Is there a way I can read a specific column from an excel file, use that data to query and select data from a table and then insert the output into another column of that same excel file.
    Please advise! Thanks

    > Is there a way I can read a specific column from an excel file, use that data to query and select data from a
    table and then insert the output into another column of that same excel file.
    Not easily. An Excel file is typically in a proprietary binary file format. Perhaps saved using the new MS Office XML format.. which would be possible to process via Oracle's XDB.
    But assuming it is in a binary format, you need "something else" to read and parse that file for you - like ODBC or DDE or COM/DCOM, etc.
    Oracle supports Heterogeneous Database Services. On a Windows Server, you can create a database link in Oracle that uses an ODBC driver to connect to an ODBC data source. There are ODBC drivers for Excel. However, this requires the data in the worksheet to be properly marked as a data table. Or did last time I looked at it about 2 years ago.
    You can also call external "interfaces" from PL/SQL using EXTPROC - such interfaces can be DLLs. Which means you do have access to the Win32 API and application APIs from PL/SQL. This can be used to access the content of an Excel file - DDE for example can quite easily do this (you use it to peek the contents of an Excel grid location), but requires Excel to be running and that spreadsheet to be loaded. DDE can also be used to poke contents (write something back to a cell in a spreadsheet).
    But using Oracle code to use an Excel file as a kind of database file... that IMO does not make a lot of sense. At all.

  • Need to read each sheet of an excel file and pass it to XI

    Hi
    Actually i need to read each sheet of an excel file and pass it to XI and will create one xml file .I am able to read the excel file by writting a custom module and it is generating the xml output from XI.But my requierment is to read the excel file and create the xml with the sheet name of the excel.suppose sheet name is sheet1, the xml file name will be  sheet1.xml.if sheet name is sheet2 the xml file name will be  sheet2 and so on....how can i pass this parameter from NWDS to SAP XI s i am passing the string which contains the sheet data.

    If I understood correct you are already reading the XLS and creating the XML (not sure if this is a separate executing body out side of XI). Are you using any sort of Object Modal in Java to read the XML? I am aware of Visual Basic object modal for Excel but not sure if one is available in Java from Microsoft.
    The Object modal that you are using must be providing an iterator to loop through each of the sheet in the Excel workbook and you should be able to create the XMLs as you desired.
    I would be glad to look at you module if you are doing it once the XI file adapter has picked up the excel file.
    VJ

Maybe you are looking for

  • Buttons not working and difficult to unlock

    hi, does anyone know how i can fix my blackberry curve 8520 or is it to be deemed unfixable!? I have been having difficulties unlocking the handset and have to hold the mute button for a long period of time, however when i came to use it the other da

  • Customer line items ledger view in ECC 6.0 other than FBL5N

    HI Is there any other T code for customer line items ledger view in ECC 6.0 other than FBL5N thanks

  • Need help with Facebook albums

    Last week I installed iPhoto 09 and uploaded my first album to Facebook - I named this album "2009". I thought I could just add photos from any event to this album, but when I tried to add photos from an event I created today called "Snow" it didn't

  • Ordering a HP Recovery Kit Windows 8

    The websites directions to order the HP Recovery kit are not up to date with the current website layout. I need to order the kit for my laptop. ENVY dv6  Product: C2M11UA#ABAModel: dv6-7210usWarranty: 1y1y0y Just looking to be pointed in the right di

  • HOW to handle a situation where 3 tables have on to many relationship with one single table?

    Hi fellows! i have three tables named Teacher_T(UserName, Pwd, Phone, Email, Experience, Academics) //here UserName is the PK Student_T(UserName, Pwd, Phone, Email) //here UserName is the PK Ad_T(UserName, Title, Description) //here UserName is the F