Is it possible to connect to a SQL Server database? |
Hi everyone. I am starting with CI4 and I would like to know if there is any way to connect to a SQL Server database. Thank you all!
![]()
@alejandro99
Here is a link that may answer your question https://codeigniter4.github.io/userguide...ments.html .
You can easily set up your database information in your .env file and easily use this function $db = db_connect();
Now variable db as been set to connect to database.
(03-26-2020, 02:27 AM)php_rocs Wrote: @alejandro99 Thanks! I didn't know CI4 isn´t supports SQLServer yet.
I use Codeigniter 3 and I'm migrating to CI4, but I'm not able to connect to the SQL Server database, as I used in CI3. In the System directory, I didn't find the drive for sqlsrv, was it removed from that version? The error message is "Class '\ CodeIgniter \ Database \ sqlsrv \ Connection' not found"
Are there plans to include this driver in CI4?
Not so much 'removed" as not done yet. Various volunteers have worked on porting from v3 to v4, but so far none have completed the work to a point where it can be included in the framework. Issue history here.
(05-28-2020, 02:02 PM)dave friend Wrote: Not so much 'removed" as not done yet. Various volunteers have worked on porting from v3 to v4, but so far none have completed the work to a point where it can be included in the framework. Issue history here. Thank you Dave! But the link refers to the MSSQL driver, I'm using SQLSRV on CI3, which is working perfectly. However in CI4, from what I verified it is not yet supported. I'll have to wait for the community to release a release with support for the sqlsrv drive.
(05-29-2020, 09:33 AM)Juliano Santos Wrote: Thank you Dave! But the link refers to the MSSQL driver, I'm using SQLSRV on CI3, which is working perfectly. However in CI4, from what I verified it is not yet supported. I'll have to wait for the community to release a release with support for the sqlsrv drive. Hi Juliano. The link is about porting the CI3 driver to CI4. Yes, it talks about the MSSQL driver but then the participants realize that starting with PHP v7.0. that driver was removed from PHP. The most recent effort (later in the discussion) uses the SQLSRV driver. It's apparently nearly ready but seems to have stalled again. Feel free to comment on the issue page. Maybe that will shake something loose and get the project rolling again. ![]() |
Welcome Guest, Not a member yet? Register Sign In |