If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-02-04, 14:55
loge loge is offline
Registered User
 
Join Date: Nov 2003
Posts: 30
getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

Hi,

i want to get back a auto generated key from v8.1 DB2 express.
So i used a JDBC 3.0 feature:

s.execute(sql, Statement.RETURN_GENERATED_KEYS);
ResultSet generatedKeysRes = s.getGeneratedKeys();

i got the error:

com.ibm.db2.jcc.c.SqlException: JDBC 3 method called - not yet supported

But an IBM document says that:
supportsGetGeneratedKeys | Yes | No | No

YES: DB2 Universal JDBC Driver support
NO: JDBC/SQLJ 2.0 Driver for OS/390 support
NO: DB2 JDBC Type 2 Driver support

http://publib.boulder.ibm.com/infoce...d/rjvjdapi.htm

So is the Type4 db2jcc.jar the same as the Type2 Driver. And how can i find the DB2 Universal JDBC Driver? Is it db2java.jar ?

Thanks for infos.
Reply With Quote
  #2 (permalink)  
Old 01-02-04, 15:02
jeeva jeeva is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

com.ibm.db2.jcc.DB2Driver can be used as type 2 or type 4

The distinction comes beased on the connection URL parameter:

if the URL pattern is "jdbc:db2://server:port/DB_INSTANCE" it points Type 4

&

if the URL pattern is "jdbc"db2:DB_INSTANCE" it points to Type 2.

-Jeeva
Reply With Quote
  #3 (permalink)  
Old 01-02-04, 15:36
loge loge is offline
Registered User
 
Join Date: Nov 2003
Posts: 30
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

yeah thanks for pointing that out, but also with Type2 access, i cant get getGeneratedKeys() working. Db2 allways says "JDBC 3 Method not supported yet".

This is crazy.

Quote:
Originally posted by jeeva
com.ibm.db2.jcc.DB2Driver can be used as type 2 or type 4

The distinction comes beased on the connection URL parameter:

if the URL pattern is "jdbc:db2://serverort/DB_INSTANCE" it points Type 4

&

if the URL pattern is "jdbc"db2B_INSTANCE" it points to Type 2.

-Jeeva
Reply With Quote
  #4 (permalink)  
Old 01-02-04, 15:47
jeeva jeeva is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

yeah,

the documentation you had reads:

In addition to the other forms of execute or executeUpdate, the DB2 Universal JDBC Driver supports the following JDBC 3.0 forms:
executeUpdate(String sql, int autoGeneratedKeys)
execute(String sql, int autoGeneratedKeys)


That means type 2 wouldnt support but type 4 should...


Dont know why it wouldnt!

-Jeeva
Reply With Quote
  #5 (permalink)  
Old 01-02-04, 15:49
jeeva jeeva is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

Did you make sure that your server version corresponds to that of this documentation?
Reply With Quote
  #6 (permalink)  
Old 01-02-04, 16:26
loge loge is offline
Registered User
 
Join Date: Nov 2003
Posts: 30
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

No, since my 8.1 is not too old, i thought it must be current.
But i can check if there are any updates available, just to be sure.

This is my version:
Stufe des DB2-Verwaltungstools:
Produkt-ID SQL08012
Aktualitäts-ID 02030106
Level DB2 v8.1.2.169
Buildlevel s030508
PTF WR21318



Quote:
Originally posted by jeeva
Did you make sure that your server version corresponds to that of this documentation?

Last edited by loge; 01-02-04 at 16:29.
Reply With Quote
  #7 (permalink)  
Old 01-02-04, 16:39
jeeva jeeva is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

Just in case you havent notices, the documentation seem to refer upto 8.1.4.
You may to find when exactly JDBC 3.0 support was added.
I tried to search, but no use..

Good Luck!
Reply With Quote
  #8 (permalink)  
Old 01-02-04, 17:58
loge loge is offline
Registered User
 
Join Date: Nov 2003
Posts: 30
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

Yeah, i know. I am just downloading FixPack4, just to be sure thats not a version problem. (cant imagine though)

Quote:
Originally posted by jeeva
Just in case you havent notices, the documentation seem to refer upto 8.1.4.
You may to find when exactly JDBC 3.0 support was added.
I tried to search, but no use..

Good Luck!
Reply With Quote
  #9 (permalink)  
Old 01-03-04, 04:52
loge loge is offline
Registered User
 
Join Date: Nov 2003
Posts: 30
Re: getGeneratedKeys() [JDBC3.0] with db2jcc.jar Type4

after upgrading to Fixpack4, getGeneratedKeys() is supported now. I am still using Type4 Universal JDBC driver (db2jcc.jar). The addition was not mentioned in the FIxPack release docs though. Anyway, i am happy that i can proceed...

Quote:
Originally posted by loge
Yeah, i know. I am just downloading FixPack4, just to be sure thats not a version problem. (cant imagine though)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On