Results 1 to 4 of 4
  1. #1
    spalax is offline Member
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default How to Read Excel file??

    Hi,
    i'm new in java prg
    i'm trying to write a code for extracting data from an excel file.

    The excel file name is : TEST.XLS
    The worksheet name is: qas
    In the Tool Administrator, the datasource name is: qa-list

    When i excecute the code, i have an error:

    java.sql.SQLException: [Microsoft][Pilote ODBC Excel] Not enough parameters 1 waited.



    here is my code:
    Java Code:
    package javaexcel;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    public class ExcelReader
    {
        public static void main( String [] args )
        {
            Connection c = null;
            Statement stmnt = null;
            try
            {
                Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
                c = DriverManager.getConnection( "jdbc:odbc:qa-list", "", "" );
                stmnt = c.createStatement();
                String query = "select URL from [qas$]where Archive=5;";
                ResultSet rs = stmnt.executeQuery( query );
    
                System.out.println( "Found the following URLs for March 2000:" );
                while( rs.next() )
                {
                    System.out.println( rs.getString( "URL" ) );
                }
            }
            catch( Exception e )
            {
                System.err.println( e );
            }
            finally
            {
                try
                {
                    stmnt.close();
                    c.close();
                }
                catch( Exception e )
                {
                    System.err.println( e );
                }
            }
        }
    }

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Why don't you use POI or JExcel?

  3. #3
    spalax is offline Member
    Join Date
    Aug 2009
    Posts
    9
    Rep Power
    0

    Default

    Problem solved.
    thanks

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. How to read Excel file with java
    By chetan-24 in forum New To Java
    Replies: 6
    Last Post: 09-13-2014, 12:43 PM
  2. JXL read excel documents
    By ironicending in forum Java Applets
    Replies: 1
    Last Post: 09-08-2010, 12:42 AM
  3. Replies: 0
    Last Post: 02-11-2009, 09:53 AM
  4. Replies: 1
    Last Post: 10-10-2008, 08:47 AM
  5. How to read data from excel and store it in db
    By saran123 in forum New To Java
    Replies: 5
    Last Post: 10-03-2008, 10:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •