|
|
| JSP+MSACCESS |
Expert:hiral
Hello,
My jsp page while running in TOMCAT 5.5 gives me the error.(have created DSN EMP)
error:java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
code============================================ <%@ page language="java" import="java.sql.*" %> <TABLE BORDER ALIGN=CENTER> <TR> <TH>EMPNO</TH> <TH>NAME</TH> <TH>SALARY</TH> <TH>DEPARTMENT</TH> <TH>DESIGNATION</TH> </TR> <% try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:EMP"); Statement st = con.createStatement(); String sql = "select * from emp";
ResultSet rs = st.executeQuery(sql); while(rs.next()) { int empno; String ename,dept,dsg; double sal; empno = rs.getInt(1); ename = rs.getString(2); sal = rs.getDouble(3); dept = rs.getString(4); dsg = rs.getString(5);
out.println("<TR>"); out.println("<TD>"+empno+"</TD>"); out.println("<TD>"+ename+"</TD>"); out.println("<TD>"+sal+"</TD>"); out.println("<TD>"+dept+"</TD>"); out.println("<TD>"+dsg+"</TD>"); out.println("</TR>"); } out.println("</TABLE>"); rs.close(); st.close(); con.close(); } catch(Exception e) { out.println(e); } %> |
| Answers |
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|