Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with FreeTDS driver

Status
Not open for further replies.

don2241

IS-IT--Management
Jun 1, 2001
57
AU
I recently updated our current FreeTDS to FreeTDS version 8.0 but existing PHP programs that is reading data from SQL Server 2000 database suddenly stopped working. The problem I found was in the SELECT statements for queries.

For example consider this SQL:

select
a.id as first_id,
b.id as second_id

from tableA a

inner join tableB b on
b.id=a.id

When referencing to the field name using PHP code -odbc_field_name(resource result_id, int field_number)- it reads both field names as id and not what I defined them like using as (first_id, second_id). If I modify the select to concatenate an empty string like below the odbc_field_name(resource result_id, int field_number) function ouputs first_id and second_id.

select
a.id+'' as first_id,
b.id+'' as second_id

My odbcinst.ini file looks like this on a Linux machine

[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsodbc.so
UsageCount = 2

Has anyone else experienced this problem and how do I fix it without having to rollback to previous FreeTDS version or is the problem somewhere else?

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top