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
Explain about Join?
What is jdbc odbc connection?
Is jdbc secure?
How can I get or redirect the log used by DriverManager and JDBC drivers?
What is getconnection method in java?
What is jdbc odbc bridge in java?
What do you understand by DDL and DML statements?
What are the standard isolation levels defined by JDBC?
Differentiate between a statement and a preparedstatement.
Which jdbc driver type s is are the jdbc odbc bridge?
List the advantages of using datasource?
Why we use while rs next ())?
How can I determine the isolation levels supported by my DBMS?
What is JDBC PreparedStatement?
What are JDBC Best Practices?