answersLogoWhite

0


Best Answer

import java.sql.*;

public class Lookup { public static voidmain(String[] args) { String dbUrl = "jdbc:odbc:people"; String user = ""; String password = ""; try { // Load the driver (registers itself) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection c = DriverManager.getConnection( dbUrl, user, password); Statement s = c.createStatement(); // SQL code: ResultSet r = s.executeQuery( "SELECT FIRST, LAST, EMAIL " + "FROM people.csv people " + "WHERE " + "(LAST='" + args[0] + "') "+ " AND (EMAIL Is Not Null) " + "ORDER BY FIRST"); while(r.next()) { // Capitalization doesn't matter: System.out.println(r.getString("Last") + ", " + r.getString("fIRST") + ": " + r.getString("EMAIL") ); } s.close(); // Also closes ResultSet } catch(Exception e) { e.printStackTrace(); } } } ///:~

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

AnswerBot

2w ago

To retrieve data from an SQL database in a JSP page, you can use Java Database Connectivity (JDBC) to establish a connection with the database, execute SQL queries to fetch the data, and then display that data on the web page by embedding Java code within JSP. Make sure to properly handle exceptions, close connections, and consider security measures to prevent SQL injection attacks.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you retrieve data from an SQL database so that it can be viewed on a web page using JSP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Information Science

How do you retrieve data stored in the database into the textarea using ASP?

To retrieve data stored in a database and display it in a textarea using ASP, you can use a server-side script to query the database and fetch the data. Then, you can populate the value of the textarea with the retrieved data by echoing it within the textarea tag during the rendering of the page.


What database objects allows you to search for and retrieve data?

SQL queries allow you to search for and retrieve data from a database. By writing SELECT statements with specific criteria, you can search for information in tables and retrieve the results based on your query.


When you request specific data from a database what is it called?

When you request specific data from a database, it is called a query. A query is a request for information from a database that matches certain criteria. This is commonly done using Structured Query Language (SQL) commands to retrieve the desired data.


What is the purpose of the SLQ database?

SQL (Structured Query Language) is a programming language used in database management to manipulate and retrieve information. Its purpose is to interact with relational databases, allowing users to create, modify, query, and manage data efficiently. SQL is widely used in various applications and systems to store and retrieve data in a structured manner.


What is a request for data from a database is called?

A request for data from a database is called a query. It is a command that is used to retrieve specific information from the database based on certain criteria.

Related questions

How do you validate and retrieve data from database?

How do you validate and retrieve data from database?" How do you validate and retrieve data from database?"


What software tool can be used to create a database add change and delete data in the database sort and retrieve data and create forms and reports using the data in the database?

datebase management system


How do retrieve data from database in c?

nbbmnbmn


How do you print using the Rollmaster software?

First you have to retrieve the data from the database by using the 'records view', 'Query' or 'report' menus. Then select print.


How do you retrieve the data from database?

To retrieve data rfrom a mysql database you first need to connect to the database using the mysql connection string(mysql_connect) after that, it's just a matter of executing a query of "SELECT `field1`, `field2` FROM `tablename`" Obviously replacing field 1 and 2 with the fields you want to replace and tablename with the table the data is stored


What database objects allows you to search for and retrieve data?

SQL queries allow you to search for and retrieve data from a database. By writing SELECT statements with specific criteria, you can search for information in tables and retrieve the results based on your query.


Data conversion and loading in database?

By data conversion we mean the data is first processed. The data after processing is ready to store in database. And from the database we can retrieve it for our use.


What is the purpose of the SLQ database?

SQL (Structured Query Language) is a programming language used in database management to manipulate and retrieve information. Its purpose is to interact with relational databases, allowing users to create, modify, query, and manage data efficiently. SQL is widely used in various applications and systems to store and retrieve data in a structured manner.


What is the select element?

To retrieve or modify data in the database query are used. There are four types of commands in SQL. Select command is data retrieval language command and is used to retrieve data from a database.In database there Four types of languages which contains various commands. Select command is the only command that is used for retrieval of data.


What software allows the user to enter retrieve and update data in an organized and efficient manner?

Any application that lets you save and retrieve a file. My best guess is that you are looking for database as an answer.


How do you retrieve data from database in PHP?

To retrieve data from a database in PHP, you can use SQL queries. First, establish a connection to the database using MySQLi or PDO. Then, use SELECT queries to fetch data from the database tables based on your requirements. Execute the query and fetch the results using appropriate functions like mysqli_fetch_assoc() or PDO fetch().


How do you manipulate a data in a database?

You can manipulate data in a database by using the DML - Data Manipulation Language statements. These include:InsertUpdate andDeleteBy using these 3 statements you can manipulate the data in a database.