Article View: aus.computers.java
Article #1100Re: help - resultset
From: Dion Gillard
Date: Fri, 16 Jul 1999 00:00
Date: Fri, 16 Jul 1999 00:00
35 lines
1577 bytes
1577 bytes
In article <378c5de5@dvs1.aus.to>, ppym@bigpond.net.au says...
| hello
|
| I'm having a bit of trouble..I have a resultset that I wish to return to
| another function, but it is created within a try { } block, thus the return
| statement cannot return it...here is the code
|
| ResultSet callDatabase ()
| {
| ResultSet rs;
| try
| {
| String url = "jdbc:odbc:HighVoltage";
| String query = "SELECT * FROM CURRENCIES";
| Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
| Connection con = DriverManager.getConnection(url,"","");
| Statement stmt = con.createStatement();
| rs = stmt.executeQuery(query);
| }
| ......
| return rs;
| }
|
| how can I get around this (I'm just a beginner to database coding).
This doesn't have anything to do with db coding....all local variables
(to a method) must be given a value.
Replace:
| ResultSet rs;
with:
| ResultSet rs = null;
--
dIon
Technical Details
Message-ID:
<MPG.11f7239baeddc3bf9896ad@news.ozemail.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<378c5de5@dvs1.aus.to>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,95c997fcc95fe86c X-Google-Attributes: gid10d6db,public From: dion@multitask.com.au (Dion Gillard) Subject: Re: help - resultset Date: 1999/07/16 Message-ID: <MPG.11f7239baeddc3bf9896ad@news.ozemail.com.au> X-Deja-AN: 501428299 Distribution: world References: <378c5de5@dvs1.aus.to> X-Trace: ozemail.com.au 932064931 210.84.12.12 (Fri, 16 Jul 1999 04:55:31 EST) Organization: Multitask Consulting NNTP-Posting-Date: Fri, 16 Jul 1999 04:55:31 EST Newsgroups: aus.computers.java