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 is jdbc in dbms?
what happen if we set JDBC string to NULL?
What do you understand by jdbc statements?
What is metadata in jdbc?
What is the function of drivermanager class?
If you are given a choice to implement the code to either insert a record or update if already exist, which approach will you follow ?
What does it mean to "materialize" data?
How do you determine the sensitivity of the ResultSet object?
What is jdbc? Describe the steps needed to execute a sql query using jdbc.
What is the function of setautocommit?
What are the types of jdbc drivers that exist?
What is jdbc odbc driver?
How does a custom RowSetReader get called from a CachedRowSet?
What are the considerations for deciding on transaction boundaries?
What are devices?