User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 428,386 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,588 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 473 | Replies: 3
Reply
Join Date: Apr 2007
Posts: 32
Reputation: push is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
push push is offline Offline
Light Poster

about jsp, jdbc....pls

  #1  
Jun 3rd, 2008
am tring get value from msaccses database with wher condition but am not get. pls give me an idea to overcome this problum. and pls..help to get data from table based on the dropdownlist vaues wich is in html page. using jsp, jdbc.......pls.....

  1. <%@ page import="java.sql.*" %>
  2. <%@page contentType="text/html" %>
  3.  
  4. <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
  5.  
  6. <HTML>
  7. <HEAD>
  8. <TITLE>Selecting tableName From a Database</TITLE>
  9. </HEAD>
  10.  
  11. <BODY>
  12. <H1>Selecting tableName From a Database</H1>
  13.  
  14. <%
  15. Int id = request.getValue("s1");
  16. Connection connection = DriverManager.getConnection("jdbc:odbc:push1", " ", " ");
  17.  
  18. Statement statement = connection.createStatement() ;
  19. ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER =7125") ;
  20. //ResultSet resultset = statement.executeQuery("select * from t1 where PART_NUMBER = "+request.getParameter('s1')") ;
  21. //ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER ='"+id+"'") ;
  22. //ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER =id") ;
  23. ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER ='"+id+"'");
  24. %>
  25.  
  26. <TABLE BORDER="1">
  27. <TR>
  28. <TH>PART_NUMBER</TH>
  29. <TH>DESCRIPTION</TH>
  30. <TH>PRICE</TH>
  31. </TR>
  32. <% while(resultset.next()){ %>
  33. <TR>
  34. <TD> <%= resultset.getInt(1) %></td>
  35. <TD> <%= resultset.getString(2) %></TD>
  36. <TD> <%= resultset.getInt(3) %></TD>
  37.  
  38. </TR>
  39. <% } %>
  40. </TABLE>
  41. </BODY>
  42. </HTML>
Last edited by peter_budo : Jun 3rd, 2008 at 4:20 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 117
Reputation: Thirusha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 13
Thirusha Thirusha is offline Offline
Junior Poster

Re: about jsp, jdbc....pls

  #2  
Jun 3rd, 2008
it is not good practice to connect to a database using jsp, rather use a servlet, and there are loads of examples online for connecting to a db using a servlet.
Reply With Quote  
Join Date: Apr 2007
Posts: 32
Reputation: push is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
push push is offline Offline
Light Poster

Re: about jsp, jdbc....pls

  #3  
Jun 3rd, 2008
thanks............
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 199
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: about jsp, jdbc....pls

  #4  
Jun 5th, 2008
and quite apart from that, using the bridge driver is also a VERY bad idea.
It's unstable, old, and poorly written.
Read the documentation, it's not intended to be used as more than a demo (and that a decade ago) of what JDBC is.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 7:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC