AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Streaming Resultset to Web Page

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Corey
Guest





PostPosted: Wed May 25, 2005 9:09 pm    Post subject: Streaming Resultset to Web Page Reply with quote



Hi All,

I am building a J2EE web application with Rational Application
Developer (WSAD 6.0) using java server faces on websphere application
server v5.1. We are pulling data from an Oracle 9i database table that
has about 1.5 million rows now but will increase to about 8 million
rows in the near future. My question is this: Can I begin displaying
the contents of my resultset as soon as data starts coming back or do I
have to wait until the resultset is complete before displaying it. Our
DBA seems to think that because SQL*Plus starts returning results right
away that a web page should be able to as well. Any ideas or examples
would be greatly appreciated. Here's my code:

public void open() throws SQLException, NamingException
//Open a connection to database
{
if (con != null)
return;
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup("jdbc/db1");
con = ds.getConnection();
}

public void close() throws SQLException, NamingException
// Close the connection and set it to null
{
if (con != null)
return;
con.close();
con = null;
}

//My datatable is bound to the result returned by this method
public Result getAvailableReports()
{
ResultSet rs = null;

try
{
setGEID((String) sessionScope.get("GEID"));
String strSQL = "SELECT col1, col2, col3, col4 FROM "
+ "table WHERE col1='" + geid + "'";
open();
Statement stmt = con.createStatement();

rs = stmt.executeQuery(strSQL);

}
catch (SQLException e)
{
e.getMessage().toString();
}
catch (NamingException e)
{
e.getMessage().toString();
}
finally
{
close();
}
return ResultSupport.toResult(rs);
}


Thanks in advance,
Corey

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.