Column Title Impact in Java - issue

Connectivity

Column Title Impact in Java - issue

hi,

I have a table with same column title(not the column names), runing a SQL on it from Java is returing same values for both the columns, it is because of same column title, but same SQL in SQL Assitant returns correct values, where can i find and confirm if same title is reason. is there a driver documentation which states this behaviour.

Also, Did explict column alias in SQL used in java.. now results are correct. let me know.

Thanks

Tags (3)
3 REPLIES
N/A

Re: Column Title Impact in Java - issue

Hi, 

It looks like there is some problem with SQL Assistant. Take a look at this: http://my.safaribooksonline.com/book/databases/sql/9780983336310/chapter-4-data-conversions/title_at...

Hope this helps.

Re: Column Title Impact in Java - issue

hi,

Thanks, im looking more from Java JDBC drive perspective, how resultset values are populated, if two columns has same title with different values. does value of first gets assigned to second as well. i know thats how its happening now.. just wanted to see the reference of this behaviour. or is it a bug in teradata jdbc driver.

Thanks.

Teradata Employee

Re: Column Title Impact in Java - issue

Are you using ResultSet getter methods that have a columnName argument? If so, then it is expected that you will only be able to retrieve one of the column values if there are two columns with the same name.

Instead, use the ResultSet getter methods that have an integer columnIndex argument.