Create a bean called JDBCQueryBean that is a modification of JDBCBean. – Essaylink

Get your Assignment in a Minimum of 3 hours

Our academic experts are ready and waiting to assist with any writing project you may have. From simple essay plans, through to full dissertations, you can guarantee we have a service perfectly matched to your needs.

Free Inquiry Order A Paper Now Cost Estimate

(i) Create a bean called JDBCQueryBean that is a modification of

 

JDBCBean. Instead of dealing only with a fixed query ‘SELECT * FROM

Accounts’, this bean should be capable of processing any query directed at the

Accounts/Stock table (depending upon which database you are using). The

code for the major method getQueryResults is supplied overleaf. In addition

to this method, the bean should provide read/write access to a property called

query that holds the current query (and has a default value of ‘SELECT *

FROM Accounts’). Read access should also be provided to properties

numFields (holding the number of fields in the query) and numRows (the

number of rows in the query results).

(ii) Create a simple HTML page that uses a text field in a form to accept the

user’s query and pass it on to a JSP called JDBCQuery.jsp.

(iii) Possibly using JDBC.jsp as a starting point, produce a JSP that accepts

the query from the above HTML page and then uses the bean to display the

results of the query in a table.

public static Vector getQueryResults()

throws SQLException

{

results = statement.executeQuery(getQuery());

metaData = results.getMetaData();

numFields = metaData.getColumnCount();

queryResults = new Vector();

fieldNames = new Vector();

dataTypes = new Vector();

for (int i=1; i<=numfields;>

fieldNames.add(metaData.getColumnName(i));

while (results.next())

{

for (int i=1; i<=numfields;>

{

int colType = metaData.getColumnType(i);

switch (colType)

{

case Types.INTEGER:

queryResults.add(results.getInt(i));

dataTypes.add(“integer”);

break;

case Types.VARCHAR:

queryResults.add(

results.getString(i));

dataTypes.add(“string”);

break;

case Types.NUMERIC:

queryResults.add(

results.getFloat(i));

dataTypes.add(“float”);

break;

default: //Hopefully, will never happen!

queryResults.add(

results.getString(i));

dataTypes.add(“string”);

}

}

}

return queryResults;

find the cost of your paper

The post Create a bean called JDBCQueryBean that is a modification of JDBCBean. appeared first on Best Custom Essay Writing Services | EssayBureau.com.

"Is this question part of your assignment? We Can Help!"

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Get Started