give me a java code snippet to connect Microsoft excel
through.... I am trying alot... plz help me.
Answer Posted / r.salimulla baba
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 ? | 15 Yes | 9 No |
Post New Answer View All Answers
What are the common jdbc exceptions?
How can I retrieve a String or other object type without creating a new object each time?
What are database warnings in jdbc and how can we handle database warnings in jdbc?
What is resultset in jdbc with example?
How does jdbc driver work?
What is meant by dao?
What is metadata in jdbc?
Is jdbc part of j2ee?
Is jdbc a framework?
What is a java driver?
How do java applications access the database using jdbc?
What is the difference between jdbc and jndi?
Can I enable requests to a jdbc connection pool for a database connection to wait until a connection is available?
What are the steps to connect to the database in java?
What is a statement?