jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes Read data from Excel??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Read data from Excel???" Watch "Read data from Excel???" New topic
Author

Read data from Excel???

Naresh Babu
Greenhorn

Joined: Mar 20, 2001
Posts: 29
Hi,
I nedd to read data from excel using JDBC.
When i give:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection"Jdbc:Odbc:ExcelDSN","","");
Statement st = con.createStatement();
Exception:
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?
Thanks
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Connection con = DriverManager.getConnection"Jdbc:Odbc:ExcelDSN","","");

Should be lower case:
Connection con = DriverManager.getConnection("jdbcdbc:ExcelDSN","","");
I assume ExcelDSN has been defined in ODBC.

[This message has been edited by Thomas Paul (edited March 23, 2001).]


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Naresh Babu
Greenhorn

Joined: Mar 20, 2001
Posts: 29
Thanks! I corrected it and now i am able to read data
from excel.But,if i try to update data using
St.executeUpdate("update [test$] set ENAME='updated' ");
where st -statement object.
I get exceptions as:Operation must be an updateable query.
Is there anything with syntax??
Thanks

[This message has been edited by Naresh Babu (edited March 23, 2001).]
[This message has been edited by Naresh Babu (edited March 23, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Read data from Excel???
 
Similar Threads
How to upload oracle data to excel
Accesing Excel data sheets through JDBC
Excel encoding / charset to read multibyte characters from java
reading excel files using jdbc odbc driver
where can I download and instal ODBC for excel