Error in reading from excel file

hi,
I have written a program which reads from excel file
and based on the value of the column i have to do something.
Everything is fine but when i run it, it produces an error message
Exception: For input string: "851.0"
the value 851.0 is acually the value of the first column.
Here is the code and i hope someone can help me to find the solution
try{
                           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                           Connection con = DriverManager.getConnection( "jdbc:odbc:exceltest" );
                           Statement st = con.createStatement();
                           ResultSet rs = st.executeQuery( "Select * from [Sheet1$] " );
                           ResultSetMetaData rsmd = rs.getMetaData();
                           int numberOfColumns = rsmd.getColumnCount();
                           while (rs.next()) {
                                        for (int i = 1; i <= numberOfColumns; i++) {
                                             if(i==1){
                                                        String columnValue1 = rs.getString(i);
                                                        custNo =Integer.parseInt(columnValue1);
                                                       // System.out.println(columnValue1);     
                                                        found=search(custNo);
                                                        if (found==false)
                                                             insert(custNo);
                                                        System.out.println(columnValue1);     
                                             else if (i == numberOfColumns && found==false)
                                                       String columnValue = rs.getString(i);
                                                       if(columnValue=="a")
                                                            incrementCusta();
                                                       else if (columnValue=="b")
                                                            incrementCustB();
                                                       else if(columnValue=="c")
                                                            incrementCustc();
                                                       else if(columnValue=="d")
                                                            incrementCustId();
                                        System.out.println("");     
                                   st.close();
                                   con.close();
                                  } catch(Exception ex) {
                                       System.err.print("Exception: ");
                                       System.err.println(ex.getMessage());
                             }

Maybe 851.0 is float value, not string.
Try Object columnValue1 =
rs.getObject(i); instead of String
columnValue1 = rs.getString(i);
You are absolutely right i actually change the line
custNo =Integer.parseInt(columnValue1);
into
custNo =Double.parseDouble(columnValue1);
Thanks alot :)

Similar Messages

  • .exe reading from Excel files

    Hi everybody,
    I know similar questions have been asked lots of times but while searching the forum didn't find an anwer to my problem.
    I created an exe file (using exe4j) of a java application which reads form Excel files. Although it works when I run it from my editor, when running the exe file it cant find the Excel file. More specifically I have this error:
    "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
    In order to read from excel files I use POI. I used it so as not to use ODBC driver and make it possible to run in every computer. When adding the driver, the exe works.Do you know a way to make it work without having to install the Driver?
    Thanks in Advance

    You need database drivers to read excel spread sheets?
    Also, why did you make it an exe? just jar it and be done with it.

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • Error While reading an Excel file from KM Folder.

    Hi Guru's,
    In my PDK Application I am trying to read an Excel file from KM Folder.
    Workbook workbook = Workbook.getWorkbook(new File("/irj/go/km/docs/documents/test/Test.xls"));
    It gives an error:
    Error:java.io.FileNotFoundException: \irj\go\km\docs\documents\test\Test.xls (The system cannot find the path specified)
    Details of appli:
    In my JspDynpage I am calling a utility Java file.
    There I have to read an  Excel and to passit to JSP.
    Details of jar files  used:
      jxl-2.6
      com.sap.security.api.jar
    Regards,
    Ram

    Hi,
    You are trying to read file wrong way. In the tutorial of Java Excel Api: "JExcelApi can read an Excel spreadsheet from a file stored on the local filesystem or from some input stream.". You are trying to read from file system. So you must get file input stream then you can read it. Please search forums KM file read.

  • Read from excel file stops at column 5(E) returns error at data variant function

    hi,
    i am read an excel file approx 15 rows by 16 rows.
    The vi works fine upto 5 rows and 5 columns and prints data on front panel after using data variant.
    The Cell range are also seems to be correct for higher rows/columns but then the errors occurs at data variant to 2d dbl stage.
    Any idea what might be wrong in the vi
    Thanks
    chintan

    Thanks for the reply.
    I found out what was wrong the data types should be the string type and i was using DBL.

  • Java Heap Space error while reading from Excel

    Hello,
    I have a data flow which reads from excel and updates records in an oracle table.
    When the data flow tries to read the excel I get a java Heap space Error.
    Error preparing to read <SUPP_STG3_FILE1>: <Java heap space>.
    Data flow <DF_SUPP_STG3_UPD> is terminated due to error <58105>.
    I have configured Excel Adapter since the server is on UNIX. BOExcelAdapter shows status as red once the execution fails. Before that BOExcel adapter status is green.
    BOExcelAdapter Trace:
    1/13/12 10:57:38 PM Thread[Thread-6,5,main]      Received an error message from the message broker. [Communication failure. Read timed out]. Will exit adapter immediately.
    1/13/12 10:57:47 PM Thread[main,5,main]      Create broker client for life-cycle management. Host:port = hikalxboes01:4001
    1/13/12 10:57:47 PM Thread[main,5,main]      Create broker client for data exchange with ASP. Host:port = hikalxboes01:4001. Client ID = com.acta.adapter.msexceladapter.MSExcelAdapter.data_18
    1/13/12 10:57:47 PM Thread[Thread-11,5,main]      Create broker client for real-time services with ASP. Host:port = 'hikalxboes01:4000''.
    1/13/12 10:57:47 PM Thread[Thread-11,5,main]      Start instance [BOExcelAdapter] of adapter [com.acta.adapter.msexceladapter.MSExcelAdapter].
    1/13/12 10:57:47 PM Thread[Thread-11,5,main]      Register the client ID [com.acta.adapter.msexceladapter.MSExcelAdapter.data_18] and adapter destination [hikalxboes01:4001] with the adapter manager.
    1/13/12 10:57:47 PM Thread[Thread-11,5,main]      Registration complete.
    1/13/12 10:58:10 PM Thread[Thread-10,5,main]      java.lang.OutOfMemoryError: Java heap space
         at org.apache.poi.hssf.usermodel.HSSFRow.addCell(HSSFRow.java:273)
         at org.apache.poi.hssf.usermodel.HSSFRow.createCellFromRecord(HSSFRow.java:196)
         at org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet(HSSFSheet.java:183)
         at org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:128)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:283)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:196)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:178)
         at com.acta.adapter.msexceladapter.MSExcelAdapterReadTable.begin(MSExcelAdapterReadTable.java:537)
         at com.acta.adapter.sdk.StreamOperationWrapper.beginStream(StreamOperationWrapper.java:88)
         at com.acta.adapter.sdk.AdapterRunnerImpl.processBeginOperation(AdapterRunnerImpl.java:1762)
         at com.acta.adapter.sdk.AdapterServiceDataListener.handleBrokerMessage(AdapterServiceDataListener.java:90)
         at com.acta.brokerclient.BrokerClient.handleMessage(BrokerClient.java:439)
         at com.acta.brokerclient.BrokerClient.access$100(BrokerClient.java:53)
         at com.acta.brokerclient.BrokerClient$MessageHandler.run(BrokerClient.java:1621)
         at com.acta.brokerclient.ThreadPool$PoolThread.run(ThreadPool.java:100)
    BOExcelAdapter Error Log:
    1/13/12 10:58:10 PM      java.lang.OutOfMemoryError: Java heap space
         at org.apache.poi.hssf.usermodel.HSSFRow.addCell(HSSFRow.java:273)
         at org.apache.poi.hssf.usermodel.HSSFRow.createCellFromRecord(HSSFRow.java:196)
         at org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet(HSSFSheet.java:183)
         at org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:128)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:283)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:196)
         at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:178)
         at com.acta.adapter.msexceladapter.MSExcelAdapterReadTable.begin(MSExcelAdapterReadTable.java:537)
         at com.acta.adapter.sdk.StreamOperationWrapper.beginStream(StreamOperationWrapper.java:88)
         at com.acta.adapter.sdk.AdapterRunnerImpl.processBeginOperation(AdapterRunnerImpl.java:1762)
         at com.acta.adapter.sdk.AdapterServiceDataListener.handleBrokerMessage(AdapterServiceDataListener.java:90)
         at com.acta.brokerclient.BrokerClient.handleMessage(BrokerClient.java:439)
         at com.acta.brokerclient.BrokerClient.access$100(BrokerClient.java:53)
         at com.acta.brokerclient.BrokerClient$MessageHandler.run(BrokerClient.java:1621)
         at com.acta.brokerclient.ThreadPool$PoolThread.run(ThreadPool.java:100)

    As Jay mentioned above it might be due to the size of the Excel spreadsheet as you might be hitting the limitation in Apache POI library used for adapter.
    What is the size of the Excel file?
    What is the value of -Xmx parameter - see DS Management Console > Adapter configuration page.
    Thank you,
    Viacheslav.

  • Getting an Error after reading a excel file

    hi
    I am reading a excel file using POI
    my code is
    package businessLogic;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
    import org.apache.poi.hssf.eventusermodel.HSSFListener;
    import org.apache.poi.hssf.eventusermodel.HSSFRequest;
    import org.apache.poi.hssf.record.BOFRecord;
    import org.apache.poi.hssf.record.BoundSheetRecord;
    import org.apache.poi.hssf.record.LabelSSTRecord;
    import org.apache.poi.hssf.record.NumberRecord;
    import org.apache.poi.hssf.record.Record;
    import org.apache.poi.hssf.record.RowRecord;
    import org.apache.poi.hssf.record.SSTRecord;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    * This example shows how to use the event API for reading a file.
    public class EventExample implements HSSFListener
    private SSTRecord sstrec;
    * This method listens for incoming records and handles them as required.
    * @param record The record that was found while reading.
    public void processRecord(Record record)
         try
    switch (record.getSid())
    // the BOFRecord can represent either the beginning of a sheet or the workbook
    case BOFRecord.sid:
    BOFRecord bof = (BOFRecord) record;
    if (bof.getType() == bof.TYPE_WORKBOOK)
    System.out.println("Encountered workbook");
    // assigned to the class level member
    } else if (bof.getType() == bof.TYPE_WORKSHEET)
    System.out.println("Encountered sheet reference");
    break;
    case BoundSheetRecord.sid:
    BoundSheetRecord bsr = (BoundSheetRecord) record;
    System.out.println("New sheet named: " + bsr.getSheetname());
    break;
    case RowRecord.sid:
    RowRecord rowrec = (RowRecord) record;
    System.out.println("Row found, first column at " + rowrec.getFirstCol() + " last column at " + rowrec.getLastCol());
    break;
    case NumberRecord.sid:
    NumberRecord numrec = (NumberRecord) record;
    System.out.println("Cell found with value " + numrec.getValue()+ " at row " + numrec.getRow() + " and column " + numrec.getColumn());
    break;
    // SSTRecords store a array of unique strings used in Excel.
    case SSTRecord.sid:
    sstrec = (SSTRecord) record;
    for (int k = 0; k < sstrec.getNumUniqueStrings(); k++)
    System.out.println("String table value " + k + " = " + sstrec.getString(k));
    break;
    case LabelSSTRecord.sid:
    LabelSSTRecord lrec = (LabelSSTRecord) record;
    System.out.println("String cell found with value " + sstrec.getString(lrec.getSSTIndex()));
    break;
         catch(Exception ex)
    * Read an excel file and spit out what we find.
    * @param args Expect one argument that is the file to read.
    * @throws IOException When there is an error processing the file.
    public static void main(String[] args) throws IOException
    // create a new file input stream with the input file specified
    // at the command line
         try
              FileInputStream fin = new FileInputStream("C:/FTERPending/FTER format.xls");
              // create a new org.apache.poi.poifs.filesystem.Filesystem
              POIFSFileSystem poifs = new POIFSFileSystem(fin);
              //      get the Workbook (excel part) stream in a InputStream
              InputStream din = poifs.createDocumentInputStream("Workbook");
              // construct out HSSFRequest object
              HSSFRequest req = new HSSFRequest();
              // lazy listen for ALL records with the listener shown above
              req.addListenerForAllRecords(new EventExample());
              // create our event factory
              HSSFEventFactory factory = new HSSFEventFactory();
              //      process our events based on the document input stream
              factory.processEvents(req, din);
              // once all the events are processed close our file input stream
              fin.close();
              // and our document input stream (don't want to leak these!)
              din.close();
              System.out.println("done.");
         catch(Exception ex)
    It prints correctly the output at the console and after that it throws an exception as
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:224)
         at org.apache.poi.hssf.eventusermodel.HSSFEventFactory.genericProcessEvents(HSSFEventFactory.java:183)
         at org.apache.poi.hssf.eventusermodel.HSSFEventFactory.processEvents(HSSFEventFactory.java:101)
         at businessLogic.EventExample.main(EventExample.java:103)
    Caused by: java.lang.ArrayIndexOutOfBoundsException
         at java.lang.System.arraycopy(Native Method)
         at org.apache.poi.hssf.record.UnknownRecord.<init>(UnknownRecord.java:62)
         at org.apache.poi.hssf.record.SubRecord.createSubRecord(SubRecord.java:57)
         at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
         at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
         at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
         at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
         ... 8 more
    I am not getting why this exception is cming
    can anyone help me pls reply

    Does your Excel file has the "AutoFilter" activated?
    If that is the problem, you have here a solution for reading a file with AutoFilter : http://article.gmane.org/gmane.comp.jakarta.poi.user/4690

  • Store data in mysql after reading from excel files

    i am trying to make o program where i will read the data from excel files and i will store them in a database. I am using eclipse as editor and mySQL. I am using APACHE POI to read the excel files and JDBC for the connection. The excel files have the structure as shown below:
    ID NAME SALARY STREET
    321 TIM 1254 14 avenue
    121 PAUL 1265 28h oktovriou
    432 NICK 4521 papaflessa
    I have of course plenty of such files which contains many more rows and columns. The purpose of my program is to read the data, create table named as the name of the excel file and the fields of each table to be the first rows of the excel file. Afterwards the values will be the rest data of the excel file. In the code below i have managed to read them, show the data in the console. Afterwrds i am trying to call a database with JDBC but there i have problem when i create the table.
    try
    String[] allFields;
    String createTableStr = "CREATE TABLE" + createTableStr
    + "(" + org.apache.commons.lang3.StringUtils.join(allFields,
    ",") + ")";
    Could anyone help me?
    Thank you in advance!:)
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.List;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.poi.ss.usermodel.Cell;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class exam1 {
    @SuppressWarnings({ "unchecked", "unchecked" })
    static void main (String[] args) throws Exception {
    String filename = "C:\\Users\\Efi\\Documents\\test5.xls";
    List sheetData = new ArrayList();
    FileInputStream fis = null;
    try {
    fis = new FileInputStream(filename);
    HSSFWorkbook workbook = new HSSFWorkbook(fis);
    HSSFSheet sheet = workbook.getSheetAt(0);
    Iterator rows = sheet.rowIterator();
    while (rows.hasNext()) {
    HSSFRow row = (HSSFRow) rows.next();
    Iterator cells = row.cellIterator();
    List data = new ArrayList();
    while (cells.hasNext()) {
    HSSFCell cell = (HSSFCell) cells.next();
    data.add(cell);
    sheetData.add(data);
    } catch (IOException e) {
    e.printStackTrace();
    } finally {
    if (fis != null) {
    fis.close();
    showExcelData(sheetData);
    @SuppressWarnings("unused")
    HashMap<String, String> tableFields = new HashMap();
    for (int i=0; i<sheetData.size();i++){
    List list = (List) sheetData.get(i);
    for (int j=0; j<list.size(); j++){
    Cell cell = (Cell) list.get(j);
    if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
    System.out.print(cell.getNumericCellValue());
    }else if(cell.getCellType()==Cell.CELL_TYPE_STRING) {
    System.out.print(cell.getRichStringCellValue());
    } else if(cell.getCellType()==Cell.CELL_TYPE_BOOLEAN) {
    System.out.print(cell.getBooleanCellValue());
    if (j < list.size() - 1) {
    System.out.print(", ");
    private static void showExcelData(List sheetData) {
    @SuppressWarnings("unchecked")
    private HashMap parseExcelData (List sheetData){
    HashMap<String,Integer> tableFields = new HashMap();
    List list = (List) sheetData.get(0);
    for (int j=0; j<list.size(); j++){
    Cell cell=(Cell) list.get(j);
    tableFields.put(cell.getStringCellValue(),cell.getCellType());
    return tableFields;
    @SuppressWarnings({ "unchecked", "unchecked", "unchecked", "unchecked", "unused" })
    private String getCreateTable(String tablename, HashMap<String, Integer> tableFields){
    Iterator iter = tableFields.keySet().iterator();
    String str="";
    String[] allFields = new String[tableFields.size()];
    int i = 0;
    while (iter.hasNext()){
    String fieldName = (String) iter.next();
    Integer fieldType=(Integer)tableFields.get(fieldName);
    switch (fieldType){
    case Cell.CELL_TYPE_NUMERIC:
    str=fieldName + "INTEGER";
    break;
    case Cell.CELL_TYPE_STRING:
    str= fieldName + "VARCHAR(255)";
    break;
    case Cell.CELL_TYPE_BOOLEAN:
    str=fieldName + "INTEGER";
    break;
    allFields[i++]= str;
    return str;
    public Connection getConnection() throws SQLException {
    try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/kainourgia","root", "root");
    Statement stmt = con.createStatement();
    try
    System.out.println( "Use the database..." );
    stmt.executeUpdate( "USE kainourgia;" );
    catch( SQLException e )
    System.out.println( "SQLException: " + e.getMessage() );
    System.out.println( "SQLState: " + e.getSQLState() );
    System.out.println( "VendorError: " + e.getErrorCode() );
    try
    String[] allFields;
    String createTableStr = "CREATE TABLE" + createTableStr
    + "(" + org.apache.commons.lang3.StringUtils.join(allFields,
    *",") + ")";*
    System.out.println( "Create a new table in the database" );
    stmt.executeUpdate( createTableStr );
    catch( SQLException e )
    System.out.println( "SQLException: " + e.getMessage() );
    System.out.println( "SQLState: " + e.getSQLState() );
    System.out.println( "VendorError: " + e.getErrorCode() );
    catch( Exception e )
    System.out.println( ((SQLException) e).getSQLState() );
    System.out.println( e.getMessage() );
    e.printStackTrace();
    return null;
    }

    Please don't multipost! Also crossposted: http://www.java-forums.org/jdbc/71612-store-data-mysql-after-reading-excel-files.html
    Mod: I'm locking this thread.

  • Error in reading from Excel

    Hi ,
    I am working in 04s and trying to read data from excel. I have used FileUpload UI Element and I am able to upload the excel file succesfully.Using the resource property of the UI Element (bound to resource from context of the type IWDResource) I am trying to read the excel file using POI api's.
    My code is as follows:
    IWDResource l_resource = null;
    l_resource = wdContext.currentContextElement().getResource();     
    InputStream  l_inputStream = l_resource.read(true);
    POIFSReader l_poifsReader = new POIFSReader();
    l_poifsReader.read(l_inputStream);
    HSSFWorkbookl_workbook = new HSSFWorkbook(l_inputStream);
    int l_sheetno = l_workbook.getNumberOfSheets();
    This code is throwing an exception at HSSFWorkbook declaration line. The exception is '" Unable to read entire header; -1 bytes read; expected 512 bytes ".
    I am using POI api's of 04. Are these api's differnt in 04s? I am getting exception
    Kindly reply as I am stuck here. or is there any other way through which i can read excel files?
    Thanks
    Rashmi

    Maybe 851.0 is float value, not string.
    Try Object columnValue1 =
    rs.getObject(i); instead of String
    columnValue1 = rs.getString(i);
    You are absolutely right i actually change the line
    custNo =Integer.parseInt(columnValue1);
    into
    custNo =Double.parseDouble(columnValue1);
    Thanks alot :)

  • Recovery Disk Error : cannot read from source file or disk HOW TO FIX ISSUE

    I have had my satellite L655-S5096 for some time now.. I had to switch out hard-drives the other day and installed windows 7 home on it from my own disk.  I tried to download all the drivers needed, but the graphics and wifi drivers never worked, so I pulled out the old toshiba disks to start from new with this harddrive.. It gets to asking me for the second disc, then the second disc gives me the the "cannot read from source file or disk PREINST8.SWM"  This is from the "out of the box" setting, which is recommended.  I do not know how to fix this issue besides reinstalling windows 7 from my disc and trying to get the drivers to work again.. however I shouldn't have to since I have the Toshiba recovery disks.. do I need new disks? 
    Yes, I also had the hard drive drivers and all of that installed.. my toshiba reads the HDD just fine.
    ~Drew

    Satellite L655-S5096
    Downloads here.
    the second disc gives me the the "cannot read from source file or disk PREINST8.SWM"
    My best guess is that the disc is not readable. Try copying it to another. Sometimes that works.
    Otherwise, order new discs from Toshiba.
    -Jerry

  • Read from Excel file in SP2013

    Hi,
    I have a requirement to read data from a formatted Excel file which is located in a document library, and put the contents in a List via code. This functionality should check - if he record exists  update the list item, if not create a new list
    item.
    I have installed the PIA assemblies and have referenced the excel iterop services dll from
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.Excel.dll
    I am trying to use the excel interop services but getting the below error :
    public void readexcelfromExcelOp()
    using (ClientContext clientContext = new ClientContext("http://development002/"))
    List docList = clientContext.Web.Lists.GetByTitle("MDRDocuments");
    lblstatus.Text = " got the document library ";
    Excel.Application xlApp = new Excel.Application();
    Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:/C.xlsx");
    Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
    Excel.Range xlRange = xlWorksheet.UsedRange;
    int rowCount = xlRange.Rows.Count;
    int colCount = xlRange.Columns.Count;
    for (int i = 1; i <= rowCount; i++)
    for (int j = 1; j <= colCount; j++)
    lblExcel.Text = xlRange.Cells[i, j].Value2.ToString();
     Error 1 at the above highlighted section of the code -  One or more types required to compile a dynamic expression cannot be found. Are you missing a reference? 
    Pallavi Sharma http://letsgetalittletechnical.blogspot.com/

    You might want to look at Excel Services and use the .../_vti_bin/ExcelRest.aspx
    http://msdn.microsoft.com/en-us/library/ee556820.ASPX
    This will allow an ajax call in the browser or web request to return Xml.  To ease access to content within Excel file setup Named Ranges.  http://development002/_vti_bin/ExcelRest.aspx/MDRDocuments/c.xlsx/model/Ranges('MyNamedRange')
    Hope this helps. 
    If looking to access Excel server-side use the OpenXML API, but avoid
    accessing the physical hard drive; put the Excel document in SharePoint.

  • BO Data Services - Reading from excel file and writing to SQL Server Table

    Hi,
    I would like to read data from an excel file and write it to a SQL Server Data base table without making any transformations using Data Services. I have created an excel file format as source and created target table in SQL Server. The data flow will just have source and target. I am not sure how to map the columns between source and target. Appreciate your quick help in providing a detailed steps of mapping.
    Regards,
    Ramesh

    Ramesh,
    were you able to get this to work? if not, let me know and I can help you out with it.
    Lynne

  • Problem in reading from excel file with my requirement

    Hi,
    Below is my input excel file format
    A    XXX
    B    XXX
    C    XXX
    D    E   F   G  H  I    J  K  L  M  N
    XX   XX  XX  XX.........................XX
    All the A...N are headings and XX's are values.
    How should I define an internal table for this requirement. I am using FM TEXT_CONVERT_XLS_TO_SAP to read input file.
    Please let me know the correct way to define internal table for the above file format.
    Regards,
    Cheritha

    Hello Cheritha,
    Your final internal table(t_final) should have all the fields viz. A, B, C, D etc.
    You need to read the file to an internal table say t_data. In the internal table t_data, the field values will be each row in this internal table.
    So you need to loop on t_data and based on the field name assign it to the corresponding field in the internal table t_final.
    Hope this is clear if any clarification please do reply
    Regards
    Farzan

  • Error in reading an Excel file

    I wrote a program that is supposed to open an excel sheet and update some values in it, here is what I wrote..
    import java.sql.*;
    import java.util.*;
    public class importFromXls
         public static void main(String args[])
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con = DriverManager.getConnection( "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=d:/samaha.xls;characterEncoding=UTF-8");
                   Statement s=con.createStatement();
                   ResultSet rs=s.executeQuery("select* from `Sheet1$`");
                   String change="update [Sheet1$] set name='Ok' where order='3'";
                   s.executeUpdate(change);
              catch(Exception ex)
                   ex.printStackTrace();
    }When I execute it, I get : "java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in WHERE clause.
    at importFromXls.main(importFromXls.java:17)"
    What would be the reason for this error ? I am sure that in the excel sheet there is a column named "name" and another one named "order".
    Thanks

    Yes, you should use PreparedStatment
    ResultSet s=null;
    PreparedStatement s = con.prepareStatement("SELECT * from [Sheet1$]");
    rs = s.executeQuery();
    String change="update [Sheet1$] set name='Ok' where order='3'";
    s.executeUpdate(change);but anyway, this code doesn't work too)) And the exception is:
    java.sql.SQLException: Driver does not support this function
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:162)
    at Testtest.main(Testtest.java:19)

  • [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messa

    Error
    [Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.  There
    may be error message
    I am using BIDS Microsoft Visual Studio 2008 and running the package to load the data from excel .
    My machine has 32 bit excel hence have set property to RUN64BITRUNTIME AS FALSE.
    But the error still occurs .
    I checked on Google and  many have used Delay validation property at Data flow task level to true but even using it at both excel connection manager and DFT level it doesnt work
    Mudassar

    Thats my connection string
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\SrcData\Feeds\Utilization.xlsx;Extended Properties="Excel 12.0;HDR=NO";
    Excel 2010 installed and its 32 bit edition
    Are you referring to install this component -AccessDatabaseEngine_x64.exe?
    http://www.microsoft.com/en-us/download/details.aspx?id=13255
    Mudassar
    You can try an OLEDB provider in that case
    see
    http://dataintegrity.wordpress.com/2009/10/16/xlsx/
    you might need to download and install ms access redistributable
    http://www.microsoft.com/en-in/download/details.aspx?id=13255
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Error running Update SQL, which has a table join

    I'm running oracle 10g. I have two tables (described below): notes table: cust - varchar(10) group -varchar(10) opportunity_id - varchar (10) activity table: cust - varchar(10) group - varchar(10) i_ref_no - integer i_vendor_control - varchar(15) cre

  • How can I filter facebook widget feeds ?

    hello everybody I've started using social widget on my nokia C7, it's really nice. I want to set the widget to render updates from specific network / friend list  as I am a member in a lot of pages and have more than 400 friend. So whenever I connec

  • No Count all Rows in Discover Plus

    Hello, in Discoverer Desktop it is possible to count all rows (menue: sheet|Count all Rows) for a query. In Discoverer Plus Version 9.0.4 i am missing this feature. Is there a work around for this problem? Franz

  • Signature Updates for AIP-SSM 10

    Hi all how can i obtain Signature Updates for AIP-SSM 10 where i am having 60 day trial license with me

  • Searching for sp35941

    hi! i've problems with this driver pack, dowloaded from hp support when i try to install, the response is: The contents of this file cannot be unpacked. the executable you are attempting to run has been corrupted, anyone could help me? thank you!