Welcome Guest, Not a member yet? Register   Sign In
Is it possible to connect to a SQL Server database?
#1

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! Smile
Reply
#2

@alejandro99

Here is a link that may answer your question https://codeigniter4.github.io/userguide...ments.html .
Reply
#3

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.
Reply
#4

(03-26-2020, 02:27 AM)php_rocs Wrote: @alejandro99

Here is a link that may answer your question https://codeigniter4.github.io/userguide...ments.html .

Thanks!

I didn't know CI4 isn´t supports SQLServer yet.
Reply
#5

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?
Reply
#6

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.
Reply
#7

(This post was last modified: 11-02-2021, 01:10 AM by InsiteFX.)

To connect to an SQL Server you need to use the DSN field in the database connection properties.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

(05-29-2020, 03:20 AM)InsiteFX Wrote: To connect to an SQL Server you need to use the DSN filed in the database connection properties.

We are talking about Ci V4 here. There isn't any driver for MS SQL.
Reply
#9

(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.
Reply
#10

(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. Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB