|
Hi Michael, To add to Bruce's comments:
does anyone know where I can get good reference manuals for the methods.
The most relevant and up to date method reference is always going to be the java.sql and javax.sql* package descriptions in the JDK's API Specification documentation. The only book I know that *really* covers everything - in terms of methods, not necessarily how to do things - is the "JDBC API Tutorial and Reference". See : http://java.sun.com/docs/books/jdbc/ Unfortunately, the latest edition is at JDBC 3.0 and written in 2003. It does have information that's difficult to get anywhere elese, but in general it's mostly for diehards like me. The JDBC Technology Guide is available from: http://java.sun.com/javase/6/docs/technotes/guides/jdbc/index.html That's one page Bruce mentioned. The technology guide amounts to excerpts from "JDBC API Tutorial and Reference" and is really worth reading. There are lots of tutorials out there. I'll mention my own, "JDBC 2.0 Fundamentals" at: http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/ That's mostly because I'm wonderful, of course ( joke, everyone, see a smiley ) but also because all of the examples were tested against DB2/400. The downside is that it's been out a while and covers only JDBC 2.0.
that a record exists on a different machine.
...
If exists(stmt.executeQuery)
I'm not sure what you're mixing above, but Statement.executeQuery() returns a ResultSet, not a boolean. Unless you did it as a stored procedure that returned an OUT parameter, you'll need to do if( myResultSet.next() ); You always get a ResultSet; it may or may not contain anything. Generally, I'd probably use something like: SELECT 1 FROM theTABLE WHERE uniqueKey= the Value assuming there's an index over uniqueKey. In theory the DBMS engine should be smart enough to see that no table value is returned and only check the index using the WHERE clause. That should be portable. Since you reference "top", I expect the remote machine is not using DB2; you may want to check other suggestions, although I still expect my suggestion is as fast as anything given a reasonably smart optimizer. HTH, Joe Sam Joe Sam Shirah - http://www.conceptgo.com conceptGO - Consulting/Development/Outsourcing Java Filter Forum: http://www.ibm.com/developerworks/java/ Just the JDBC FAQs: http://www.jguru.com/faq/JDBC Going International? http://www.jguru.com/faq/I18N Que Java400? http://www.jguru.com/faq/Java400 ----- Original Message ----- From: "Bruce Jin" <brucej@xxxxxxxxxxxxxxxxxxxx> To: "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> Sent: Tuesday, February 13, 2007 9:54 AM Subject: Re: JDBC help
JDBC Api reference: *http://java.sun.com/javase/6/docs/technotes/guides/jdbc/ JDBC basics: http://java.sun.com/docs/books/tutorial/jdbc/ * Michael_Schutte@xxxxxxxxxxxx wrote:I'm just getting started with JDBC, does anyone know where I can get
good
reference manuals for the methods. While I have your attention, I want to write a procedure that will
validate
that a record exists on a different machine. I already have a procedure that returns records back to the iSeries. I was thinking that it would look something like this... <code> stmt = "select * from table"; If exists(stmt.executeQuery) { return true;} else {return false;} </code> If that doesn't work, I'd imagine that I could just say select top 1
*
from table then check rs.next I'm just looking for the best performance on getting data from this external machine. Please advise... Michael Schutte Admin Professional Bob Evans Farms, Inc. Visit us on the web! www.bobevans.com We've built a better hotcake -- Stacked and Stuffed Hotcakes -- coming January 11th! For hotcake tips, interviews with our chefs and more, check out the
Stacked
and Stuffed blog at http://imstuffed.blogspot.com-- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.