FAQ
Finding some odd and intermittent issues with DBD::ODBC when doing
multiple database joins. If I do a multiple database join as in the SQL
below, and do not have a where clause, or have a where clause and do not
bind values, I get an SQL-08S01: "Read from SQL server failed". If I
remove one of the joins, it works. If I do a WHERE 1 = ? and bind a 1,
it works. This looks to be a bug, but I am unsure if anyone else has
seen this. For now, I am adding a "WHERE 1 = ?" at the end and binding
a 1 to work around it. I am using unixODBC 2.2.11 and and DBD::ODBC
1.17 (also tried this with 1.22). I can post a DBI trace if needed as
well. Query looks like it runs fine running SQL profiler. Query as
follows.



SELECT

srvChkCon_Id, hst_Id,

HostServiceChecks.hst_Id as host,

ServiceCheckContacts.hstSrvChk_Id,

HostServiceChecks.srvChk_Id as scname,

srvChkCon_ContactId,

srvChkCon_DayNight,

otherdb..contact.first_name + ' ' + otherdb..contact.last_name
as name,

srvChkCon_CallBack

FROM ServiceCheckContacts

INNER JOIN HostServiceChecks ON
HostServiceChecks.hstSrvChk_Id = ServiceCheckContacts.hstSrvChk_Id

LEFT JOIN otherdb..contact ON
otherdb..contact.contact_id = ServiceCheckContacts.srvChkCon_ContactId"



Thanks.



Chase Putans

Search Discussions

  • Martin J. Evans at Jun 30, 2009 at 10:00 pm

    Chase Putans wrote:
    Finding some odd and intermittent issues with DBD::ODBC when doing
    multiple database joins. If I do a multiple database join as in the SQL
    below, and do not have a where clause, or have a where clause and do not
    bind values, I get an SQL-08S01: "Read from SQL server failed". If I
    remove one of the joins, it works. If I do a WHERE 1 = ? and bind a 1,
    it works. This looks to be a bug, but I am unsure if anyone else has
    seen this. For now, I am adding a "WHERE 1 = ?" at the end and binding
    a 1 to work around it. I am using unixODBC 2.2.11 and and DBD::ODBC
    1.17 (also tried this with 1.22). I can post a DBI trace if needed as
    well. Query looks like it runs fine running SQL profiler. Query as
    follows.



    SELECT

    srvChkCon_Id, hst_Id,

    HostServiceChecks.hst_Id as host,

    ServiceCheckContacts.hstSrvChk_Id,

    HostServiceChecks.srvChk_Id as scname,

    srvChkCon_ContactId,

    srvChkCon_DayNight,

    otherdb..contact.first_name + ' ' + otherdb..contact.last_name
    as name,

    srvChkCon_CallBack

    FROM ServiceCheckContacts

    INNER JOIN HostServiceChecks ON
    HostServiceChecks.hstSrvChk_Id = ServiceCheckContacts.hstSrvChk_Id

    LEFT JOIN otherdb..contact ON
    otherdb..contact.contact_id = ServiceCheckContacts.srvChkCon_ContactId"



    Thanks.



    Chase Putans
    Which ODBC Driver are you using?

    What is the full error text you are getting?

    Can you send me a DBD::ODBC trace at level 15 and a unixODBC trace?

    To get a unixODBC trace you need to add

    [ODBC]
    Trace = yes
    TraceFile = /tmp/unixodbc.log

    to the odbcinst.ini.

    Sounds like an ODBC driver problem to me but when we get the traces
    we'll know more. Just send them to me as attachments on this list of any
    size get stripped.

    Martin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedJun 30, '09 at 7:29p
activeJun 30, '09 at 10:00p
posts2
users2
websitedbi.perl.org

2 users in discussion

Chase Putans: 1 post Martin J. Evans: 1 post

People

Translate

site design / logo © 2022 Grokbase