Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

give me a java code snippet to connect Microsoft excel
through.... I am trying alot... plz help me.

Answer Posted / n.gowtham raj

import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;

public class EmployeeReader1 {
public static void main(String[] args) {
Connection connection = null;
try {
Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:gowtham");
Statement st = con.createStatement
();
ResultSet rs = st.executeQuery
("select * from [Sheet1$]");

while(rs.next())
{
System.out.println
("USER ID:"+rs.getString("ID"));
}

rs.close();
st.close();
} catch (Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}
}
}

Step 1: goto control panel and select the Administrative
Tools and click the odbc driver.
Step 2: Then click the add button and select the microsoft
excel driver (".xls")
Step 3: then give the dsn name. (gowtham).
Step 4: then click the select workbook button and choose
the excel file then it work well.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the common JDBC problems that you got and how do you solved them?

2393


What is jdbc class forname?

922


When do we get java.sql.SQLException: No suitable driver found?

916


What is xe in oracle jdbc url?

1008


What is jdbc stand for?

880


Can I enable requests to a jdbc connection pool for a database connection to wait until a connection is available?

847


What is connection pooling and why it is used?

950


What are the ddl statements?

812


Which constraint cannot be specified as an explicit constraint and should be specified with the column only ?

886


How many types of jdbc drivers are there?

958


List the advantages of using datasource?

955


How to connect html page to database using jdbc?

854


How can I instantiate and load a new CachedRowSet object from a non-JDBC source?

932


What are the different classes through which JDBC represents statements?

877


What is jdbc in java?

877