read excel data
1 posts in topic
Flat View  Flat View

Posted By:   naresh_babu
Posted On:   Friday, March 23, 2001 09:49 AM

I need to read data from excel using JDBC.
When i give:

Connection con = DriverManager.getConnection"Jdbc:Odbc:ExcelDSN","","");
Statement st = con.createStatement();

I am getting Exception as:java.sql.SQLException: [Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified

Please , tell me where i am doing wrong?


Re: read excel data

Posted By:   Sanjit_Bose  
Posted On:   Wednesday, March 28, 2001 04:45 AM

Steps required for making connection to Excel workbook thro' JDBC program.

1> Make a DSN by selecting your workbook as a datasource(ofcourse through the Excel Driver)

2> Open the DSN

3> Your Excel sheet must have field names in the 1st row.

The most quirious part is that what one should write in the SQL query.
and the answer is that one has to use the sheet name appended with a
'$' sign.

for refernce here goes a small program

import java.sql.*;

public class jdbcex


public static void main(String s[])




Connection con = DriverManager.getConnection("Jdbc:Odbc:sanjit","","");//'sanjit' is the name of my DSN

Statement st = con.createStatement();

int p = st.executeUpdate("insert into "sheet2$" values ('xyz','sanjit')");//data inserted in sheet2


catch(Exception e)




Sanjit Bose
About | Sitemap | Contact