Welcome Guest, Not a member yet? Register   Sign In
[split] MS SQL server driver?

(This post was last modified: 07-12-2016, 09:18 AM by ciadmin.)


Will CI 4 support connecting to MS SQL server still seeing as PHP 7 no longer supports the MSSQL (php_mssql.dll) extensions? I've tried looking through the github repo under Database/System/Database and can only find one reference to "mssql".

I can also see in http://forum.codeigniter.com/thread-65543.html that "Database adapters for other RDBs" is lined up for phase 2. But it's not clear if that also includes MS SQL.

Before anyone asks why I need to connect to MS SQL, it's because my PHP application needs to query information from other systems that use MS SQL Server as their database engine of choice.


I am not overly familiar with MS SQL, yet, but I believe it can be accessed through either the ODBC drivers or through PDO still in 7.

So, yes, it will be supported at some point. If you want to take point on adding support to it, we'll be happy to help you along the way as we can. One challenge will be getting testing working in Travis, which is something we'd like to get setup. I believe we've seen it can be done, but that part looks to be a right pain. Smile

The PHP manual entry for the MSSQL extension includes a list of alternatives for MS SQL Server support in PHP: Ideally, all of these will be available in CI4, but, as Lonnie pointed out, testing will be an issue. The up side is that this will be the case with most of the remaining driver implementations, and is by no means unique to the SQLSRV or ODBC drivers.

Although MS SQL Server is generally listed as one of the top 3 database platforms (alongside Oracle and MySQL), it probably is not among the top 3 for CI users (due to a combination of a rocky history of support for platforms other than MySQL and a general bias towards free/open source platforms). With the smaller potential user base, the testing aspects become more important, because there's a smaller chance that someone who needs the driver will be able to fix any issues on their own, and fewer people will be using the drivers to find the issues in the first place.

Personally, MS SQL Server provided the best developer (and maintenance) experience of any of the SQL platforms I've used to date, so it is certainly a platform which I feel is worth supporting. However, since I no longer use Windows on a regular basis, it's a little more difficult to setup a development environment to start hacking away at the driver.

@mwhitney The MS SQL available to linux in a preview edition (https://www.microsoft.com/en-us/cloud-pl...r-on-linux). So if you wish to support it with CI4 then you should request access to the preview build. Wink If Travis not supports it at least you can test it on a local machine.

I'm currently running OS X. I have VMs on my machine for both Linux and Windows (Linux is a VM of my previous computer, just in case; the Windows VM is used primarily for testing IE and working with Active Directory). I might even have SQL Server setup on the Windows VM, though I doubt I have it exposed to the host machine, at the moment. The Windows client makes SQL Server a great platform to work with, but Windows itself has moved backwards in usability as a desktop environment in the last decade or so, and running it in a VM doesn't improve the experience.

So, I can probably get an instance of SQL Server up and running for development, it's just not 90% ready for me (as it would be if I were developing in Windows).

Thanks for the note regarding MS SQL on Linux, though. In the long run, it might help with the testing issues, given that it should make Travis integration slightly easier. It's just not really the issue holding me back at the moment.

Thanks for the responses (and for taking me seriously even though I mentioned MS SQL Smile )

I can confirm that I've managed to get my CI3 application connecting to the MS SQL server again by changing the following entries in my database.php

'dsn' => "DRIVER={ODBC Driver 13 for SQL Server};SERVER=;DATABASE=MSSQLDBName"
'dbdriver' => 'odbc'

I also installed the ODBC driver as per this link https://msdn.microsoft.com/en-us/library....110).aspx  (which was a bit painful as I didn't understand what was needed initially - but in hindsight it's actually quite straightforward)

Now I am VERY new to CI and really only beginner level with PHP so before I realised the above changes were all I needed to make it work, I went about editing the mssql_driver.php in system/database/drivers/mssql (don't shoot me, I was desperate and I knew it was the wrong way of fixing it, even temporarily) - but my final result worked and was pretty close to the odbc_driver.php file Big Grin (which I then found while looking around the files)

So maybe there's still hope.

As for helping with testing, I am sure there are more experienced people who would be better at this, but I'd be willing to help if you think I'd be of any use.

Setting up and running tests for the drivers should not be difficult if you already have a connection to a SQL Server instance configured.

The main issue with testing is with setting up the automated tests for Travis in the CI4 repository on GitHub. For some database platforms, there's a fairly well-documented procedure to configure Travis to start a database instance to use for testing. However, of the many CI3 database drivers, MySQL, PostgreSQL, and SQLite3 are the only platforms covered in that document.

Once you get beyond the built-in platforms, very few people have documented the process for other database platforms, and it appears that the process can be significantly different for each platform.

Theme © iAndrew 2016 - Forum software by © MyBB