View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
09132Bug reportsRemoteControlpublic2014-09-11 01:36
Reporterjalpesh Assigned Toc_schmitz  
PriorityhighSeveritycrash 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09132: Not able to connect Remote API, it throw "Request error: CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]" Error
Description

Hi,

I am using LimeSurvey 2.0.5 and MSSQL (SQL Server 2008 R2 ). I have install LimeSurvey on Linux machine. LimeSurvey work fine but when i connect through API it throw following error.

"Request error: CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 102 General SQL Server error: Check messages from the SQL Server [102] (severity 15) [(null)]"

Steps To Reproduce

When i debug this issue in code, i found following code which case problem.

if($sDatabasetype=='sqlsrv' || $sDatabasetype=='mssql' || $sDatabasetype=='dblib')
{
$this->data=$this->hexToStr($this->data);
}
Above code is in session.php file.
Now when I comment above code in file, API function work fine and give response.

Some More information,
Code work fine till get session key. when we use any function except "get_session_key" it throw above error

Additional Information

PHP Code:-

<?php
require_once 'jsonRPCClient.php';

define( 'LS_BASEURL', 'http://10.10.65.171/lime');
define( 'LS_REMOTEURL', '/index.php/admin/remotecontrol');
define( 'LS_USER', 'admin');
define( 'LS_PASSWORD', 'password');

$rt = new jsonRPCClient( LS_BASEURL . LS_REMOTEURL);
$sSessionKey = $rt->get_session_key(LS_USER, LS_PASSWORD);
if (is_array($sSessionKey)) {
print $sSessionKey['status'];
die();
}

try{
if($rt->list_users($sSessionKey)){
print "<pre>";print_r($rt->list_users($sSessionKey));print "</pre>";
}
else{
print "in else";
}

}catch(exception $e){
echo nl2br($e->getMessage()).'<br />'."\n";
}
$rt->release_session_key($sSessionKey);
?>

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)Version 2.05+
I will donate to the project if issue is resolvedNo
BrowserMozilla
Database type & versionMSSQL (SQL Server 2008 R2 )
Server OS (if known)Linux
Webserver software & version (if known)Apache
PHP Version5.3.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2014-07-24 13:08

administrator   ~30342

Last edited: 2014-07-24 13:10

LimeSurvey on Linux and DB on MSSQL is always asking for problems ;). Have you configured FreeTDS to use the proper protocol version?

https://manual.limesurvey.org/Troubleshooting#No_questions_are_shown_when_using_MSSQL_Server_with_FreeTDS_on_Linux

jalpesh

jalpesh

2014-07-28 15:43

reporter   ~30364

Yes, I did try all. I have change tds version as following
[global]
host = xxx.xxx.xxx.xxx (host name or ip of the MSSQL server)
port = 1433
client charset = UTF-8
tds version = 8.0

But still not working. I am facing same issue as above.

Let me know if you want me try some other solution.

c_schmitz

c_schmitz

2014-09-08 23:01

administrator   ~30502

Yes, I was able to reproduce it and the way you fixed it was all right. Thank you!

c_schmitz

c_schmitz

2014-09-08 23:03

administrator   ~30503

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=14460

c_schmitz

c_schmitz

2014-09-11 01:36

administrator   ~30559

2.05 Build 140911 released.

Related Changesets

LimeSurvey: master 7de185eb

2014-09-08 21:03:27

c_schmitz

Details Diff
Fixed issue 09132: Remote API won't work when using MSSQL dblib driver on Linux Affected Issues
09132
mod - application/models/Session.php Diff File

Issue History

Date Modified Username Field Change
2014-07-04 15:25 jalpesh New Issue
2014-07-04 15:27 jalpesh Issue Monitored: jalpesh
2014-07-04 15:31 jalpesh Issue End Monitor: jalpesh
2014-07-24 11:51 c_schmitz Assigned To => c_schmitz
2014-07-24 11:51 c_schmitz Status new => assigned
2014-07-24 13:08 c_schmitz Note Added: 30342
2014-07-24 13:08 c_schmitz Status assigned => feedback
2014-07-24 13:10 c_schmitz Note Edited: 30342
2014-07-28 15:43 jalpesh Note Added: 30364
2014-07-28 15:43 jalpesh Status feedback => assigned
2014-09-08 23:01 c_schmitz Note Added: 30502
2014-09-08 23:01 c_schmitz Status assigned => resolved
2014-09-08 23:01 c_schmitz Fixed in Version => 2.05+
2014-09-08 23:01 c_schmitz Resolution open => fixed
2014-09-08 23:03 c_schmitz Changeset attached => LimeSurvey master 7de185eb
2014-09-08 23:03 c_schmitz Note Added: 30503
2014-09-11 01:36 c_schmitz Note Added: 30559
2014-09-11 01:36 c_schmitz Status resolved => closed