Welcome Guest, Not a member yet? Register   Sign In
How to connect SQLSRV using SQLSRV driver?
#1

With the latest CI4 version I'm able to use SQLSRV driver to DB Connections, but I'm understand how I can configure the driver to be connectec successfully? I've tried:

PHP Code:
    public $mulord = [
        
'DSN'      => '',
        
'hostname' => 'IP_HERE',
        
'username' => 'sa',
        
'password' => 'PASS',
        
'database' => 'DB_NAME',
        
'DBDriver' => 'SQLSRV',
        
'DBPrefix' => '',
        
'pConnect' => false,
        
'DBDebug'  => (ENVIRONMENT !== 'production'),
        
'charset'  => 'utf8',
        
'DBCollat' => 'utf8_general_ci',
        
'swapPre'  => '',
        
'encrypt'  => true,
        
'compress' => false,
        
'strictOn' => false,
        
'failover' => [],
        
'port'     => 1433,
    ]; 

But doesn't work... Then I'm try based on this topic:
https://forum.codeigniter.com/thread-785...ght=SQLSRV

And continue without work (Unable to connect to the database).

I really will be possible to remote connect in SQL Server using SQLSRV driver?
Reply
#2

Make sure that you have installed the mssql driver right.

Read:

Connect Codeigniter PHP7.3 to MSSQL
What did you Try? What did you Get? What did you Expect?

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

(This post was last modified: 02-15-2021, 05:20 AM by ajmeireles.)

MSSQL or SQLSRV driver? We are talking about CI4, right? The tutorial you've sent is CI3.

(02-15-2021, 01:41 AM)InsiteFX Wrote: Make sure that you have installed the mssql driver right.

Read:

Connect Codeigniter PHP7.3 to MSSQL

MSSQL or SQLSRV driver? We are talking about CI4, right? You've sent a tutorial from CI3.
Reply
#4

No the point was for you to check and make sure that you have all of the Microsoft drivers installed.

It should not matter if it is CI 3 or CI 4 the configuration should be the same.
What did you Try? What did you Get? What did you Expect?

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

1. The web is hosted in a  cPanel hosting using this PHP setup:
https://puu.sh/HgZhA/2274686967.png

2. The driver configuration has been set like this:
https://puu.sh/HgZhY/dc9dc8b968.png

3. The query (homecontroller):
https://puu.sh/HgZij/59671da1f3.png

... SQL is running and port 1433 is opened on firewall. All my other programs using pdo_dblib work fine to connect on SQL.

I honestly don't know where is the error.
Reply
#6

Don't know if this is important, but you are using 'SQLSRV' instead of 'sqlsrv' as the driver name...

Maybe these steps can help you as a usecase...
https://futbolsalas15.wordpress.com/2014...ter-works/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB