JSP Java Tutorial

<%@ page  import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; %>

    
        Accessing the Publishers Database Table
    
    
        

Accessing the Publishers Database Table


        <% 
            Connection connection = DriverManager.getConnection(
                "jdbc:odbc:data", "UserName", "password");
                Statement statement = connection.createStatement() ;
                ResultSet resultset = statement.executeQuery("select pub_name from Publishers") ; 
        %>
        
            
                Name
            
            <% while(resultset.next()){ %>
                
                     
                        <%= resultset.getString(1)%>  
                    
                
            <% } %>