| |
|
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.
|
 |

09-23-10, 11:10
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 7
|
|
|
Problems with aliases in DB2 9.x X JDBC 4
|
|
Hi,
Sorry about my english
When I use the driver JDBC 4 (db2jcc4.jar) for the DB2 9.X and I make a selection with column alias, in the exibition the columns names keep their original names.
E.g.:
SELECT c1 as t1 from table1
c1
--
X
Y
Z
does anybody have any idea about this problem?
thanks in advance
|
|

09-23-10, 11:56
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
|
|
This must be your application problem.
Code:
C:\Temp>clpplus -nw user/password@localhost:50000/database
CLPPlus: Version 1.3
Copyright (c) 2009, IBM CORPORATION. All rights reserved.
Database Connection Information :
---------------------------------
Hostname = localhost
Database server = DB2/NT SQL09073
SQL authorization ID = user
Local database alias = DATABASE
Port = 50000
SQL> create table table1(c1 char(1));
DB250000I: The command completed successfully.
SQL> insert into table1 (c1) values ('X'),('Y'),('Z');
DB250000I: The command completed successfully.
SQL> select c1 as t1 from table1;
T1
--
X
Y
Z
SQL>
CLPPlus is a Java application that uses the jcc driver.
|
|

09-23-10, 13:26
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 7
|
|
|
outras under
|
|
Hi n_i,
Thank you for your post.
But, beyond the application I am getting errors in DBVisualizer, too.
When I set the driver how JDBC 2 (db2jcc.jar), the application works.
But, when I use the native driver JDBC 4 (db2jcc4.jar) I get this wrong behavior.
|
|

09-23-10, 16:12
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
Quote:
Originally Posted by diecc
Hi n_i,
Thank you for your post.
But, beyond the application I am getting errors in DBVisualizer, too.
When I set the driver how JDBC 2 (db2jcc.jar), the application works.
But, when I use the native driver JDBC 4 (db2jcc4.jar) I get this wrong behavior.
|
What do you mean by "native driver"? They are both jdbc drivers (DB2 Type 4), just different versions.
The db2jcc.jar is NOT the same as the DB2 Type 2 driver.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

09-24-10, 15:29
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 7
|
|
Again, sorry about my english.
I made some mistakes:
instead of native I meant pure java;
both drivers are pure java;
db2jcc.jar is JDBC 3, not JDBC 2.
When I wrote JDBC 4, I wanted to say specification 4 of JDBC, not JDBC type 4. How in manual:
"db2jcc.jar and sqlj.zip for 3.0 support"
"db2jcc4.jar and sqlj4.zip for support of some JDBC 4.0 functions;"
The specification JDBC 4 has some new functions very interesting, but I dont know how to use the aliases.
Could it be any servers configuration?
|
|

09-24-10, 15:55
|
|
Registered User
|
|
Join Date: Nov 2003
Posts: 2,407
|
|
Quote:
Originally Posted by diecc
but I dont know how to use the aliases
|
You should use ResultSetMetaData.getColumnLabel() instead of getColumnName()
|
|

09-27-10, 10:01
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 7
|
|
|
Thanks
Thanks everybody.
If the specification JDBC 4 is not compatible with the specification JDBC 3 in relation to this method, then the way is to migrate my projects.
Thanks one more time.
|
|

09-27-10, 10:15
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
|
|
|
|

09-27-10, 10:45
|
|
Registered User
|
|
Join Date: Sep 2010
Posts: 7
|
|
|
The solution
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|