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.....

<%@ page import="java.sql.*" %>
<%@page contentType="text/html" %> 

<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>

<HTML>
    <HEAD>
        <TITLE>Selecting tableName From a Database</TITLE>
    </HEAD>

    <BODY>
        <H1>Selecting tableName From a Database</H1>
            
          <% 
            Int id = request.getValue("s1");            
            Connection connection = DriverManager.getConnection("jdbc:odbc:push1", " ", " ");

            Statement statement = connection.createStatement() ;
            ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER =7125") ; 
            //ResultSet resultset = statement.executeQuery("select * from t1 where PART_NUMBER = "+request.getParameter('s1')") ;
            //ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER ='"+id+"'") ;          
            //ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER =id") ;
              ResultSet resultset = statement.executeQuery("select * from T1 where PART_NUMBER ='"+id+"'");      
%>

        <TABLE BORDER="1">
            <TR>
                <TH>PART_NUMBER</TH>
                <TH>DESCRIPTION</TH>
                <TH>PRICE</TH>
                            </TR>
            <% while(resultset.next()){ %>
            <TR>
                <TD> <%= resultset.getInt(1) %></td>
                <TD> <%= resultset.getString(2) %></TD>
                <TD> <%= resultset.getInt(3) %></TD>
                
            </TR>
            <% } %>
        </TABLE>
    </BODY>
</HTML>

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.

thanks............

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.