View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
19050Bug reportsQuestion editorpublic2024-09-03 17:48
Reporterzufolo441 Assigned Toc_schmitz  
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version6.2.x 
Summary19050: Unable to add new question when DB is MSSQL
Description

Hi, when I try to create a new question, I obtain a 404 error. Please see attachments.
I have an identical installation but PostgreSQL-based, and it works.

Steps To Reproduce

Steps to reproduce

add a question and save it

Expected result

question created.

Actual result

404 error

TagsNo tags attached.
Attached Files
Screenshot_20230825_100104.png (69,762 bytes)   
Screenshot_20230825_100104.png (69,762 bytes)   
Bug heat10
Complete LimeSurvey version number (& build)6.2.4
I will donate to the project if issue is resolvedYes
BrowserFirefox 116
Database type & versionMicrosoft SQL Server 2012 (SP3-GDR) (KB4019092) - 11.0.6251.0 (X64)
Server OS (if known)Debian 12
Webserver software & version (if known)nginx + php-fpm
PHP Version8.2

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2023-08-25 10:16

administrator   ~76704

We currently don't have the internal resources to debug MSSQL. Your best bet is to yourself write a pull request that fixes it.

DenisChenu

DenisChenu

2023-08-25 10:32

developer   ~76705

Strange : questionIs is added.
Can you check the url with PGSQL ?

zufolo441

zufolo441

2023-08-25 13:05

reporter   ~76712

Hi, I solved by replacing dblib driver with MS SQL ODBC, version 17.6 . Newer versions aren't able to connect to SQL Server 2012 without encryption.

zufolo441

zufolo441

2023-08-25 13:08

reporter   ~76713

Hi, Denis: i checked DB and question hasn't been added. I tried to edit existing question, but changed were not saved. But, this survey was imported from lss file without problems. Now I try yo use ODBC instead of dblib.

thanks to everyone!

zufolo441

zufolo441

2023-08-25 14:01

reporter   ~76714

meanwhile, trying to activate survey, I found an ortographic error in two files:
application/models/SurveyActivator.php: mssql_drop_coulmn_with_constraints($this->survey->responsesTableName, 'id');
application/helpers/admin/activate_helper.php:function mssql_drop_coulmn_with_constraints($tablename, $columnname)

..and in SurveyActivator is missing the declaration:
require_once(DIR . '/../helpers/admin/activate_helper.php');
I added it at row 375, I hope is the right place.
without it I have a missing function error.

DenisChenu

DenisChenu

2023-08-25 15:29

developer   ~76716

Last edited: 2023-08-25 15:29

Hi, Denis: i checked DB and question hasn't been added. I tried to edit existing question, but changed were not saved. But, this survey was imported from lss file without problems. Now I try yo use ODBC instead of dblib.

Oh it's the redirect after the creation,
Link when create are like that /index.php?r=questionAdministration/create&surveyid=489424

Then : there are an hidden issue when create. Our system didn't check if it's really created after redirect.

Can you test with debug with 2 ?

About MS SQL ODBC and encryption : add :TrustedServerCertificate=1 at end of the connexionstring (after the database name)

zufolo441

zufolo441

2023-08-25 16:42

reporter   ~76725

Hi, for encryption: the problem is related to our servers: we have an old 2012 version, and I cannot upgrade it. it works only with a version of ODBC that doesn't force encryption to TLS 1.2.
I tried to set encryption=no and TrustServerCertificate=true or false but I didn't solve until I downgraded MS ODBC from 18 to 17.6 .

for MSSQL driver: using ODBC instead of dblib (in debian enabled by installing package php8.2_sybase) it seems to work.
I'm using pdo_sqlsrv and sqlsrv obtained from https://packages.microsoft.com/debian/10/prod/pool/main/m/msodbcsql17/

DenisChenu

DenisChenu

2023-08-25 16:48

developer   ~76727

On one instance set :TrustedServerCertificate=1 work, without : no connexion …
IIS server (on both side for me) maybe ?
More a php-mssql option then.

zufolo441

zufolo441

2023-08-26 00:05

reporter   ~76734

Hi, Denis,
I do use Debian 12+nginx+php8.2.
I tried IIS and it worked flawless, but I don't want to use it in production.

DenisChenu

DenisChenu

2023-08-28 08:46

developer   ~76739

I tried IIS and it worked flawless, but I don't want to use it in production.

It's not the purpose, just to find a way.

seems mssql accept TrustedServerCertificate only on IIS. Maybe some other way oin linux to get the good certificate OR accept any certificate. But it's not related to this issue ...

zufolo441

zufolo441

2023-08-28 12:02

reporter   ~76746

I read elsewehere that SQL Server 2012 doesn't support TLS 1.2 and it causes problems with all OSes with OpenSSL v3...

gabrieljenik

gabrieljenik

2023-08-29 21:06

manager   ~76772

Great that the problem is solved. Please, can you leave some conclusions to add to doc?
Thanks!

DenisChenu

DenisChenu

2023-08-30 08:25

developer   ~76774

If i don't make error : problem is NOT really solved

  1. using dblib driver
  2. Error seems hidden somewhere

But : hard to reproduce since need a server with DBlib driver

@zufolo441 : can you test with same server, with dblib and LimeSurvey 5 ?

zufolo441

zufolo441

2023-08-30 10:21

reporter   ~76779

Hi,
regarding Lime, there is a bug in application/models/SurveyActivator.php : it is unable to find function mssql_drop_coulmn_with_constraints() until I add

require_once(DIR . '/../helpers/admin/activate_helper.php');

declaration somewhere in file. There is an ortographic error in function name too.

regarding dblib, my opinion is that the problem is more OS/PHP/library related. There are problems with DDL: LS is unable to create tables.
Example: I was able to import survey from lss file, but I couldn't activate it.

In this moment I cannot do tests because I have only that server, I'm the only linux admin in a Microsoft-ed organization :-) so, I couldn't use PGSQL as I usually did.
In a rapid observation of LS code, it seemed to me that dblib and sqlserver drivers have quite the same treatment, for that reason I don't think the problem is in the php code...

DenisChenu

DenisChenu

2023-08-30 10:37

developer   ~76780

I think compare LS5 against LS6 can be really intersiting
Same with LS3
Not compare code, just test if it work.

If it work on LS3 : it can woirk on LS5 and LS6 ;)

c_schmitz

c_schmitz

2024-09-03 17:48

administrator   ~80887

This issue should be fixed with fixes for 19578

Issue History

Date Modified Username Field Change
2023-08-25 10:08 zufolo441 New Issue
2023-08-25 10:08 zufolo441 File Added: Screenshot_20230825_100104.png
2023-08-25 10:08 zufolo441 File Added: Screenshot 2023-08-25 at 10-07-52 CHttpException.png
2023-08-25 10:16 ollehar Note Added: 76704
2023-08-25 10:16 ollehar Bug heat 0 => 2
2023-08-25 10:16 ollehar Priority none => normal
2023-08-25 10:16 ollehar Summary unable to add new question when DB is MSSQL => Unable to add new question when DB is MSSQL
2023-08-25 10:32 DenisChenu Note Added: 76705
2023-08-25 10:32 DenisChenu Bug heat 2 => 4
2023-08-25 13:05 zufolo441 Note Added: 76712
2023-08-25 13:05 zufolo441 Bug heat 4 => 6
2023-08-25 13:08 zufolo441 Note Added: 76713
2023-08-25 14:01 zufolo441 Note Added: 76714
2023-08-25 15:29 DenisChenu Note Added: 76716
2023-08-25 15:29 DenisChenu Note Edited: 76716
2023-08-25 16:42 zufolo441 Note Added: 76725
2023-08-25 16:48 DenisChenu Note Added: 76727
2023-08-26 00:05 zufolo441 Note Added: 76734
2023-08-28 08:46 DenisChenu Note Added: 76739
2023-08-28 12:02 zufolo441 Note Added: 76746
2023-08-29 21:06 gabrieljenik Note Added: 76772
2023-08-29 21:06 gabrieljenik Bug heat 6 => 8
2023-08-30 08:25 DenisChenu Note Added: 76774
2023-08-30 10:21 zufolo441 Note Added: 76779
2023-08-30 10:37 DenisChenu Note Added: 76780
2023-08-30 16:35 gabrieljenik Status new => confirmed
2024-09-03 17:48 c_schmitz Assigned To => c_schmitz
2024-09-03 17:48 c_schmitz Status confirmed => closed
2024-09-03 17:48 c_schmitz Resolution open => fixed
2024-09-03 17:48 c_schmitz Note Added: 80887
2024-09-03 17:48 c_schmitz Bug heat 8 => 10