What is wrong with my code?

2585 pts.
Tags:
Oracle
Posed on behalf of SearchOracle member Deepa: Question: How can I get a oracle database connection? Here is a code to which accepts username and password and checks for validation. is it correct? Pls tel me import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.lang.String; public class Form extends HttpServlet{ private ServletConfig config; private String username=null; private String password=null; private Hashtable errors; public void init(ServletConfig config)throws ServletException{ this.config=config; } public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String username=null; String password=null; Hashtable errors; res.setContentType("text/html"); PrintWriter out=res.getWriter(); req.getSession(); username=req.getParameter("username"); password=req.getParameter("password"); try{ if(username!=null && username.equals("username")){ getServletConfig().getServletContext(). getRequestDispatcher("my projects/qpro/src/process"); }else{ errors.put("username" enter a valid name); username=""; } if(password==null){ errors.put("password" Enter a valid username); password=""; } else{ getServletConfig().getServletContext(). getRequestDispatcher("my projects/qpro/src/process "); } String getErrorMsg(String s){ String errormsg=(String)errors.get(s.trim()); return (errormsg==null) ? "":errormsg; } } catch(Exception e){ out.println(e.getMessage()); } out.println("<html><head><title>Enter username and passowrd</title></head>"); out.println("<body><center>Enter username and password</center>"); out.println("<br>"); out.println("<table align='center' cellspacing='2' cellpadding='0'>"); out.println("<tr>"); out.println("<td>UserName</td>"); out.println("<td><input type='text' name='Username' size='10' maxlength='15'></td>"); out.println("</tr>"); out.println("<tr>"); out.println("<td>Password</td>"); out.println("<td><input type='password' name='password' maxlength='15'></td>"); out.println("</tr>"); out.println("<tr>"); out.println("<td>"); out.println("<input type='button' value='Submit'></td>"); out.println("<td><input type='button' value='reset'></td>"); out.println("</tr>"); out.println("</table></body</html>"); } } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ doGet(req,res); } }

Answer Wiki

Thanks. We'll let you know when a new response is added.

pass this connection string to oracle:-
“Provider=MSDAORA.1;Password=;User ID= ;Data Source= Oracle’s Host String ;Persist Security Info=True”

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following