<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
Joining Tables
Joining Tables
<%
Connection connection = DriverManager.getConnection(
"jdbc:odbc:data", "Steve", "password");
Statement statement = connection.createStatement();
String query = "SELECT a.fname, a.lname, titleauthor.id " +
"FROM authors JOIN titleauthor ON authors.id = titleauthor.id";
ResultSet resultset =
statement.executeQuery(query) ;
%>
First Name
Last Name
Book ID
<% while(resultset.next()){ %>
<%= resultset.getString(1) %>
<%= resultset.getString(2) %>
<%= resultset.getString(3) %>
<% } %>