Обсуждение: Postgresql and JDBC
I've got some questions on using POSTGRESQL with JDBC. Some folks on the Novice mailing list suggested I use the interfaces mailing list, but the web site suggests that I should use another. Which mailing list is appropriate. I would like to do a read & update of a single record. I've seen several examples of using JDBC to update an entire table, but I'm only looking to modify a single record. Is this a case where I should use getCursorName? How do I then do an UPDATE to only modify that single record? Is this multi user safe? I've tried the JDBC 2.0 updateXXX functions, but they are apparently not implemented for Postgresql yet. Are there any good (in depth) examples of JDBC out there? The only ones I've seen are limited to a simple SELECT or UPDATE. Thanks. BTW, my complements to the POSTGRESQL developers on a nice product. ===== Wayne Johnson, | There are two kinds of people: Those 3943 Penn Ave. N. | who say to God, "Thy will be done," Minneapolis, MN 55412-1908 | and those to whom God says, "All right, (612) 522-7003 | then, have it your way." --C.S. Lewis __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/
Quoting Wayne Johnson <wdtj@yahoo.com>: > I've got some questions on using POSTGRESQL with JDBC. Some folks on > the > Novice mailing list suggested I use the interfaces mailing list, but > the > web site suggests that I should use another. Which mailing list is > appropriate. pgsql-jdbc@postgresql.org - its a new list created due to the ammount of traffic. I've got to update the jdbc pages this week. > I would like to do a read & update of a single record. I've seen > several > examples of using JDBC to update an entire table, but I'm only looking > to > modify a single record. Standard SQL, ie UPDATE table SET col=value WHERE keycol=keyvalue; Then use executeUpdate() from within Statement. The basic example in the source included this. > > Is this a case where I should use getCursorName? How do I then do an > UPDATE to only modify that single record? Is this multi user safe? No, cursors are mainly used to manage large result sets. > I've > tried the JDBC 2.0 updateXXX functions, but they are apparently not > implemented for Postgresql yet. No. UpdateableResultSet is not yet available (partly done), and you can't guarantee it working on all ResultSet's anyhow (see the JDBC2.0 specs). > > Are there any good (in depth) examples of JDBC out there? The only > ones > I've seen are limited to a simple SELECT or UPDATE. The source has some (src/interfaces/jdbc/example) Peter -- Peter Mount peter@retep.org.uk PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/ RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
[ Charset ISO-8859-1 unsupported, converting... ] > Quoting Wayne Johnson <wdtj@yahoo.com>: > > > I've got some questions on using POSTGRESQL with JDBC. Some folks on > > the > > Novice mailing list suggested I use the interfaces mailing list, but > > the > > web site suggests that I should use another. Which mailing list is > > appropriate. > > pgsql-jdbc@postgresql.org - its a new list created due to the ammount of > traffic. > > I've got to update the jdbc pages this week. PostgreSQL.org web site is already update. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
At 11:51 30/01/01 -0500, Bruce Momjian wrote: >[ Charset ISO-8859-1 unsupported, converting... ] > > Quoting Wayne Johnson <wdtj@yahoo.com>: > > > > > I've got some questions on using POSTGRESQL with JDBC. Some folks on > > > the > > > Novice mailing list suggested I use the interfaces mailing list, but > > > the > > > web site suggests that I should use another. Which mailing list is > > > appropriate. > > > > pgsql-jdbc@postgresql.org - its a new list created due to the ammount of > > traffic. > > > > I've got to update the jdbc pages this week. > > >PostgreSQL.org web site is already update. Yes, but jdbc.postgresql.org isn't ;-) >-- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 853-3000 > + If your life is a hard drive, | 830 Blythe Avenue > + Christ can be your backup. | Drexel Hill, Pennsylvania 19026