DBI + DBD::ODBC + unixODBC + FreeTDS + SQL Server error



I have a Perl application which uses the DBI library to do it's
database work. The backend database is a SQL Server database that I am
communicating through unixODBC using the FreeTDS library as the ODBC
driver.

This application runs and works fine on the Windows platform. Basically
I am getting some kind of error message when executing a
selectall_arrayref statement.

DBI::db=HASH(0x878de94) trace level set to 8 in DBI 1.32-ithread
-> selectall_arrayref for DBD::ODBC::db
(DBI::db=HASH(0x878df9c)~0x878de94 ' SELECT "Key", Value FROM
UserProfile WHERE UserID = ? ' HASH(0x87ed968) '55') thr#804bc70
1 -> prepare for DBD::ODBC::db (DBI::db=HASH(0x878de94)~INNER '
SELECT "Key", Value FROM UserProfile WHERE UserID = ? '
HASH(0x87ed968)) thr#804bc70
dbih_setup_handle(DBI::st=HASH(0x876e9f0)=>DBI::st=HASH(0x87eda70),
DBD::ODBC::st, 878e1e8, Null!)
dbih_make_com(DBI::db=HASH(0x878de94), DBD::ODBC::st, 212)
thr#804bc70
dbih_setup_attrib(DBI::st=HASH(0x87eda70), Err,
DBI::db=HASH(0x878de94)) SCALAR(0x876ec0c) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x87eda70), State,
DBI::db=HASH(0x878de94)) SCALAR(0x876ec54) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x87eda70), Errstr,
DBI::db=HASH(0x878de94)) SCALAR(0x876ec30) (already defined)
dbih_setup_attrib(DBI::st=HASH(0x87eda70), Debug,
DBI::db=HASH(0x878de94)) 8 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x87eda70), FetchHashKeyName,
DBI::db=HASH(0x878de94)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x87eda70), HandleError,
DBI::db=HASH(0x878de94)) undef (not defined)
initializing sth query timeout to 0
ignore named placeholders = 0
dbd_preparse scanned 1 distinct placeholders
SQLPrepare returned 0

dbd_st_prepare'd sql f142549208, ExecDirect=0
SELECT "Key", Value FROM UserProfile WHERE UserID = ?
1 <- prepare= DBI::st=HASH(0x876e9f0) at ../framework/Auth/User.pm
line 162 via ../framework/Data/DataObject.pm line 186
bind 1 <== '55' (attribs: ), type 0
dbd_st_execute (outparams = 0)...
bind 1 <== '55' (size 2/3/0, ptype 4, otype 1, sqltype 12)
bind 1 <== '55' (len 2/2, null 0)
bind 1: CTy=1, STy=VARCHAR, CD=80, Sc=0, VM=2.
SQLBindParameter: idx = 1: fParamType=1, name=1, fCtype=1, SQL_Type
= 12, cbColDef=80, scale=0, rgbValue = 87ed708, cbValueMax=2, cbValue =
2
Param value = 55
rebind check char Param 1 (55)
dbd_st_execute (for hstmt 142549208 before)...
dbd_st_execute (for hstmt 142549208 after, rc = -1)...
dbd_error: err_rc=-1 rc=0 s/d/e: 142549208/142142352/142140928
dbd_error: err_rc=-1 rc=0 s/d/e: 0/142142352/142140928
dbd_error: err_rc=-1 rc=0 s/d/e: 0/0/142140928
st_execute/SQLExecute error -1 recorded: (DBD: st_execute/SQLExecute
err=-1)
!! ERROR: -1 '(DBD: st_execute/SQLExecute err=-1)'
<- selectall_arrayref= undef at ../framework/Auth/User.pm line 162
via ../framework/Data/DataObject.pm line 186
DBD::ODBC::db selectall_arrayref failed: (DBD: st_execute/SQLExecute
err=-1) at ../framework/Auth/User.pm line 162.
-> DESTROY for DBD::ODBC::st (DBI::st=HASH(0x87eda70)~INNER)
thr#804bc70
SQLFreeStmt called, returned -1.
dbd_error: err_rc=-1 rc=0 s/d/e: 142549208/142142352/142140928
dbd_error: err_rc=-1 rc=0 s/d/e: 0/142142352/142140928
dbd_error: err_rc=-1 rc=0 s/d/e: 0/0/142140928
st_destroy/SQLFreeStmt(SQL_DROP) error -1 recorded: (DBD:
st_destroy/SQLFreeStmt(SQL_DROP) err=-1)
<- DESTROY= undef at ../framework/Auth/User.pm line 163
-> STORE for DBD::ODBC::db (DBI::db=HASH(0x878de94)~INNER
'TraceLevel' 0) thr#804bc70
DBD::ODBC unsupported attribute passed (TraceLevel)
STORE DBI::db=HASH(0x878de94) 'TraceLevel' => 0
<- STORE= 1 at ../framework/Auth/User.pm line 163 via
.../framework/Data/DataObject.pm line 186

As you can see it is getting an error when calling the ODBC function
SQLExecute but it doesn't output what the problem it. Only that there
is a problem. I tried reducing the problem to a simple script that just
connects to the database, executes the query and prints the result to
the command line. When I do that it works fine. But within the
application I get the above behavior. Is there anyway I can get more
information about what the actual error message is?

Any help is greatly appreciated. I have spent most of the day examining
the DBD-ODBC library and I can't quite figure out what my problem is.
The ODBC connection seems fine (by the fact that isql and my simple
test script work fine). The application should be fairly fine because
it runs under Windows. I just can't isolate the problem.

Eric

.



Relevant Pages

  • Re: Login failed for user sa. (Error code: 18456).
    ... What transport mechanism is your default for SQL? ... > SQL Server database name: ... I tried windows authentication to access sql server database. ... I got different error message as "Login failed for user ...
    (microsoft.public.sharepoint.portalserver)
  • Re: MS Access with Linked tables Security Issue
    ... connect to SQL Server database with one Super ID that has all the super ... Dim dbs As Database, rs As Recordset, tdfAccess As TableDef ... Set dbsODBC = OpenDatabase ...
    (microsoft.public.access.forms)
  • Re: How to error-proof Doug Steels "FixConnections"?
    ... rather than letting them type in the server and database name. ... you could also store the information in a table in the front-end. ... SQL Server database from the backup, how to get rid of the annoying ...
    (microsoft.public.access.externaldata)
  • Clone SQL DB (using VB?)
    ... I'm having a SQL Server database called X. ... So I need to update the script ... When I snap my fingers, ...
    (microsoft.public.sqlserver.msde)
  • Problem using command.parameters
    ... I need to get data from a sql server database and insert records into a sqlce ... database if they do not already exist in the sqlce database. ... the code below but I'm getting an error message when the cmd.Prepareline ...
    (microsoft.public.dotnet.languages.csharp)