Question
How to Connect to an Excel Spreadsheet using JDBC in Java

Answers

Follow the steps below
First setup the new ODBC datasource. Goto Administrative Tools−>Data Sources (ODBC)−>System DSN tab−>Add−>Driver do Microsoft Excel(*.xls)−>Finish. Now give the Data Source Name (SampleExcel) & Description. Next, click Select Workbook and point to your excel sheet.
In the code make to following code additions

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbcodbcSampleExcel","","");
stmt = conn.createStatement();
sql = "select * from [Sheet1$]";
rs=stmt.executeQuery(sql);

Where Sheet1 is the excel sheet name.   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q How to move a table?
  • Q Is Java Compiled or an Interpreted language ?
  • Q Is there any tool to calculate how much time should be allocated for testing out of total development?
  • Q what is the flexion
  • Q You do not seem to have all the required experience. Why shoudl we hire you?
  • Q I'm on v5.0 is it worth upgrading to v6.0?
  • Q What are the functions of a load manager?
  • Q What are the advantages and disadvantages of open loop control system ?
  • Q Which day was observed as the International Day for Preventing the Exploitation of the Environment in War and Armed Conflict?
  • Q How was Boris Karloff listed in the credits 1931 Frankenstein
  • Q Mathml is xml-based. Will the browser manufacturers support xml fully? will they support mathml natively?