wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply locked New topic


Ganapathy palanisamy

Joined: May 29, 2008
Posts: 22
[size=12]hai friends,
I am doing the program for reading the data from excel.
import java.io.*;
import java.sql.*;
public class ExcelReadTest{
public static void main(String[] args){
Connection connection = null;
Connection con = DriverManager.getConnection( "jdbc:odbc:emp" );
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) System.out.print(", ");
String columnValue = rs.getString(i);

} catch(Exception ex) {
System.err.print("Exception: ");

in the above works well to retrieve the data from excel. But i want to select particular cell value.. i.e i want to select the column heading from excel.

guide me friends..
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60782

Please UseCodeTags, and please UseAMeaningfulSubjectLine.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: JSP
Similar Threads
Reading an Excel file using Java
The specified DSN contains an architecture mismatch between the Driver and Application
How to insert data into excel file using java code?
Readin excel files from Java & output
Calling the Excel file using Java