connecting to mssql with using jsp

Reply

Join Date: Apr 2004
Posts: 127
Reputation: johnroach1985 is an unknown quantity at this point 
Solved Threads: 0
johnroach1985's Avatar
johnroach1985 johnroach1985 is offline Offline
Junior Poster

connecting to mssql with using jsp

 
0
  #1
Oct 10th, 2004
Hi just started this new jsp course stuck in this so if you guys can please help would be very happy.The problem is this i am trying to make a jsp that asks for a username and a password and the thing is i am trying to put these datas into a database cool idea ain't it all original .but the problem is that i can't get connected to sql i don't know it just won't work bet i made millions of mistakes i am not aware of.Anyways a simple site to test it.My data base is named pass the and the password is pass to make it easy .And i am usin an apache-tomcat 5.0.28 and a 1.4java thats all you need i thinks if you need more please post i am just a desperate student trying to learn .Oh the code here it is...
P.S.:please help me don't just read and pass please pretty please:cry: :cheesy:
  1.  
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  3. "<a rel="nofollow" class="t" href="http://www.w3.org/TR/html4/loose.dtd" target="_blank">http://www.w3.org/TR/html4/loose.dtd</a>">
  4. <html>
  5. <head>
  6. <title>Mr.Duke Is Back</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. </head>
  9. <body>
  10. <%
  11. public void baglan(){
  12. try {
  13. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  14. conn=DriverManager.getConnection("jdbc:odbc:pass","pass","pass");
  15. }
  16. catch (Exception ex) {%><%
  17.  
  18. out.print("alert()");
  19. %><%}
  20. String name=request.getParameter("name");
  21. String pass=request.getParameter("password");
  22. String sql="INSERT INTO pass (marka, tip, seri, fiyat, ekran)";
  23. sql +=" VALUES (N'"+name+"', N'"+pass+"')";
  24. %>
  25. <p align="center"><a href="register.htm" >Registration</a>&nbsp;&nbsp;&nbsp;<a href="login.htm">Log In</a>&nbsp;&nbsp;&nbsp;<a href="">Contact Us</a></p>
  26. <p align="center">&nbsp;</p>
  27. <p align="center"><img src="duke_kahve_fincani.gif" width="96" height="112"></p>
  28. <p align="center"><font size="+3" color="#009933"><b>Disributor Network System</b></font> </p>
  29. <p align="center"><font size="+2" color="#009933"><b>Log In</b></font> </p>
  30. <form action="index2.htm">
  31. <table>
  32. <tr>
  33. <td>Name:</td>
  34. <td><input name="name" type="text" size="25"></td>
  35. </tr>
  36. <tr>
  37. <td>Password:</td>
  38. <td><input name="password" type="password" size="25"></td>
  39. </tr>
  40. </table>
  41. <p align="center">
  42. <input type="submit" name="Submit" value="Submit">&nbsp;&nbsp;&nbsp;
  43. <input type="reset" name="Submit2" value="Reset">
  44. </p>
  45. </form>
  46. <a href="register.htm">New members click here!</a>
  47. <p align="center" > <img src="computerbanner.gif" width="400" height="70"></p>
  48. <p > </p>
  49. </body>
  50. </html>
Last edited by johnroach1985; Oct 10th, 2004 at 2:11 pm. Reason: java changed to jsp
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC