package com.yourcompany.struts.model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
public class BookBean {
ArrayList<Book> totlebook = new ArrayList<Book>();
public ArrayList process() throws ClassNotFoundException, SQLException
{
Statement stmt;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String URL = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ftp";
Connection conn;
conn = DriverManager.getConnection(URL,"sa","11");
stmt=conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from bookline");
while(rs.next())
{
Book bookers = new Book(rs.getString(1),rs.getString(2),rs.getString(3));
totlebook.add(bookers);
}
return totlebook;
}
}