this is my problem
my jsp page is

<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:truth","sa","");
Statement st=con.createStatement();
String cate=request.getParameter("T3");
String user=request.getParameter("user");
String pass=request.getParameter("passwd");
String reenter=request.getParameter("rpasswd");
String mail=request.getParameter("mail");
String credit=request.getParameter("credit");
String address=request.getParameter("add");
String city=request.getParameter("city");
String state=request.getParameter("state");
String country=request.getParameter("country");
String mobile=request.getParameter("mobile");
out.println(user+pass+mail+mobile+address+city+state+country);

st.executeUpdate("insert into usertable values('"+user+"','"+pass+"','"+mail+"','"+mobile+"','"+address+"','"+city+"','"+state+"','"+country+"')");
response.sendRedirect("Index.jsp");
%>

this page must give a result login page with details fetched from database sql server 2005
but it displays an error as below

i am using windows xp and apache tomcat 6.0 and sql server 2005
the odbc connections were connected to the database successfully

and i can get the data when the same program was written in java but i cant get in this jsp

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
	org.apache.jsp.Validation_jsp._jspService(Validation_jsp.java:82)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
	sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
	sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
	sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
	sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
	java.sql.DriverManager.getConnection(Unknown Source)
	java.sql.DriverManager.getConnection(Unknown Source)
	org.apache.jsp.Validation_jsp._jspService(Validation_jsp.java:59)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
Apache Tomcat/6.0.26

says it all, really. The specified database isn't there.

And -10000 points for using the jdbc-odbc bridge driver and MS Access in a distributed environment.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.