Im trying to access the databsae values & displaying it on the screen..my database connections r alright & evn the db is also rite..but its not displayin anything on the screen..can u help me??

<html>
<head><Title> login details </title><head>

<%@page language="java" import="java.io.*,java.sql.*"  %>

<body>
<% 
	String name="";
	String pass="";
	try
	{
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		Connection con=DriverManager.getConnection("jdbc:Odbc:mydsn");
		Statement st=con.createStatement();
		ResultSet rs=st.executeQuery("select * from notice");
		while(rs.next())
		{
			name=rs.getString(1);
			out.write(name);	
		pass=rs.getString(2);
out.write(pass);
		}
	}catch(Exception e){System.out.println(e); }
	System.out.println("name");
//	out.write();
	out.write(pass);
%>

</body>
</html>

Beside you not using [code]

[/code], there is obviously your attempt to connect to DB from JSP instead from servlet/bean and wrong coding for DB connectivity. Read tutorial on JDBC Access for basic background

and then there's the use of the JDBC/ODBC bridge driver which is also a recipe for disaster.
And the bad "Title" tag in the html (browsers won't generally complain, but it's not correct).

ok but can u tel me which wil be then rite code??

just send me the rite code if possible

This article has been dead for over six months. Start a new discussion instead.