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 / amar

import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Connect extends HttpServlet
{
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection con=null;
Statement st=null;
PreparedStatement pst=null;
ResultSet rs;
try
{
Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection
("jdbc:odbc:Std","","");
st=con.createStatement();
rs=st.executeQuery("select * from
[ExcelSheetName$]");
while(rs.next())
{
out.println(rs.getString
(1));
out.println(rs.getString
(2));
out.println(rs.getString
(3));
}
}
catch(Exception e)
{
System.out.println("Errr :"+e);
}
}
}

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is transaction processing in jdbc?

953


Does the JDBC-ODBC Bridge work with Microsoft J++?

2268


How do I start debugging problems related to the JDBC API?

967


What is jdbc class forname?

922


What are the different classes through which JDBC represents statements?

877


Which type of JDBC driver is the fastest one?

1043


What is getconnection method in java?

881


What are the factors that the jdbc driver performance depends upon?

909


What is the JDBC syntax for using a literal or variable in a standard Statement?

948


What protocol does jdbc use?

929


Is uri the same as url?

865


Can I set up a connection pool with multiple user IDs? The single ID we are forced to use causes problems when debugging the DBMS.

900


How many packages are available in jdbc api?

922


How data can be inserted into long row column of database?

2109


Why do we need jdbc api?

920