Results 1 to 6 of 6
- 01-02-2013, 11:53 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 5
- Rep Power
- 0
How to get data from 2nd row in Excel using JDBC
Hi,
Here, am stucking at this point. I have an excel sheet. From this excel i need to get the data and i dont want first 2 rows data. The column names are in 3rd row and I need to select the excel at run time, but not at the time of DSN creation.
Please help on this
- 01-02-2013, 04:12 PM #2
Member
- Join Date
- Dec 2012
- Location
- Des Moines, IA
- Posts
- 33
- Rep Power
- 0
Re: How to get data from 2nd row in Excel using JDBC
How about you show us the work you have done so far. Have you looked into Apache POI?
- 01-03-2013, 07:24 AM #3
Member
- Join Date
- Dec 2012
- Posts
- 5
- Rep Power
- 0
Re: How to get data from 2nd row in Excel using JDBC
Thanks for your reply.
No, I didnt check with POI.
- 01-03-2013, 07:26 AM #4
Member
- Join Date
- Dec 2012
- Posts
- 5
- Rep Power
- 0
Re: How to get data from 2nd row in Excel using JDBC
And am trying to create DSN at run time. I have tried with the below code. Please have a look.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
PrintWriter pw=response.getWriter();
//establish connection
String url = "jdbc:odbc:Driver={MicroSoft Excel Driver (*.xls,*.xlsx)};DBQ=D:\\Jagadeesh\\Sample.xls";
con=DriverManager.getConnection(url,"","");
//create a statement
stmt=con.createStatement();
//execute the statement
ResultSet rs=stmt.executeQuery("select distinct id,sal,name from [Sheet1$]");
while(rs.next())
{
String did=rs.getString(1);
String name=rs.getString(2);
String date=rs.getString(3);
pw.println(did+" "+name+" "+date);
}
- 01-03-2013, 07:30 AM #5
Member
- Join Date
- Dec 2012
- Posts
- 5
- Rep Power
- 0
- 01-03-2013, 11:21 AM #6
Re: How to get data from 2nd row in Excel using JDBC
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
getting data from excel
By laosu in forum New To JavaReplies: 2Last Post: 02-17-2011, 08:29 AM -
How to add data into excel file
By computechsolutions in forum JDBCReplies: 1Last Post: 10-04-2010, 12:29 PM -
How to fetch integer data from excel
By nehakuls in forum JDBCReplies: 5Last Post: 11-24-2009, 01:52 PM -
Excel Multibyte JDBC Driver / Very Urgent Requirement
By phanindar in forum Advanced JavaReplies: 0Last Post: 11-17-2008, 11:46 AM -
Reading data form Excel using Jdbc (example)
By Java Tip in forum Java TipReplies: 0Last Post: 02-13-2008, 11:23 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks