DreamsCoder.com

We Code your Dreams


home > Connect Database and Retrieve values using JSP




Connect Database and Retrieve values using JSP





<%@ page import="java.sql.*" %>

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

        
        <% 
            Connection connection =
DriverManager.getConnection(
                "jdbc:odbc:data", "userName",
"password");

            Statement statement =
connection.createStatement() ;
            ResultSet resultset =
statement.executeQuery("select * from Publishers") ; 
        %>

    

        
            <% while(resultset.next()){ %>
            
            <% } %>
        
ID Name City State Country
<%= resultset.getString(1) %> <%= resultset.getString(2) %> <%= resultset.getString(3) %> <%= resultset.getString(4) %> <%= resultset.getString(5) %>

Label - java





by - Chinmay Mahajan





Are you looking for something else?


Suggested Programs




Difference between ArrayList and LinkedList in Java with example


AES Encryption and Decryption using Java


Dynamically Updating a List in JAVA


Upload and Preview Image using JFrame in Java


Chat application using Socket programming in JAVA