Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Lew" Subject: Re: java resultset Message-ID: X-Comment-To: comp.lang.java.databases Newsgroups: comp.lang.java.databases In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 37 Date: Wed, 27 Apr 2011 15:21:41 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303917701 96.60.20.240 (Wed, 27 Apr 2011 10:21:41 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:21:41 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.databases:89 To: comp.lang.java.databases Dave Miller wrote: > a wrote: >> Hi >> >> Can I create a resultset that have all the specified columns? And, I >> have to >> populate it with data. When the database is offline, then I can >> simulate it >> to test my code. Please provide simple example. >> >> Thanks >> >> > A resultset is stored in memory - I'm unsure what you mean about > "offline". To get all of the columns, ask for all of the columns. > > A simple resultset example: > > java.sql.Connection c = DriverManager.getConnection("your driver and > path to db", "your db user id", "your db password"); > Statement get = c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, > ResultSet.CONCUR_READ_ONLY); > ResultSet rs = get.executeQuery("your query"); > > //use your result set from here The newer RowSet interface lets you disconnect from the database while using the results, unlike normal ResultSets. -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24