This code snippet converts the Excel file into a virtual database with the sheets as tables. No need to create and DSN in the system is the plus of this snippet.
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
Class.forName(driver);
Connection connection = DriverManager.getConnection(
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=F:\\Kishore\\exam.xls;
DriverID=22;READONLY=false","", "");
You can use the following query to get the values from the sheets.
select * from [Sheet1$]
The first row is considered as the column as usual. Here the empty columns will not be considered.
But there is a disadvantage in this. If you encounter let me know, i will give the solution :)
Flickr Photostream
குருதியில் பூக்கள் நனையும் போது உறவுகள் உறங்கலாமோ?
temp
Contributors
- Kishore
- Everybody struggles and overcomes them. Some i come across and the way i did it.