
hi i m having trouble with the following code. when i run it i get the error as invalid oracle url specified. i am using tomcat 6 and oracle 10g release2 10.2.0.3. heres the code
<html>
<head>
<title>check</title>
</head>
<body>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%String m=null;
String m1=null;
String s=request.getParameter("t1");
PreparedStatement ps=null;
Connection cn=null;
ResultSet rs=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
cn=DriverManager.getConnection("jdbc:oracle:thin@127.0.0.1:1521","system","tiger");
ps=cn.prepareStatement("select * from emp where name=?");
ps.setString(1,s);
rs=ps.executeQuery();
while(rs.next())
{
m=rs.getString(1);
m1=rs.getString(2);
}
out.println("Emp id :" +m);
out.println("Name :" +m1);
%>
</body>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.