Support the ongoing development of Laravel.io →
Configuration Database
Last updated 2 years ago.
0

Have you ever tried freetds?

Last updated 2 years ago.
0

Is there a tutorial on the subject, yesterday I spend a whole day trying to connect a CentOS apache with an MsSql server but with no success. :(

Last updated 2 years ago.
0

Ok, I've finally figured this out. FreeTDS is a given you must install this first. Once you've installed FreeTDS be sure to test it at the command line by going through the steps here: http://www.freetds.org/userguide/confirminstall.htm

Once you've done that I had to install the FreeTDS development tools then finally php-mssql and that gave me PDO_DBLIB, which worked out of the box with Laravel's sqlsrv. You may need to add a new repo to your yum database, as follows:

rpm -ivh http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

cd /etc/yum.repos.d/
wget http://rpms.famillecollet.com/enterprise/remi.repo

yum install freetds
yum install freetds-devel
yum install --enablerepo=remi php-mssql

Remember to test FreeTDS at the command line to actually determine whether you can get a database connection as it will help you debug any problems before you hit Laravel.

Any problems give me a nudge.

Last updated 2 years ago.
0

Wow, you had the same problem as me!! :)

And exactly same solution!! Just I came later!!

Just wondering, i'm still facing a problem; standard connection setup, returns accented chars in result to come as � both on var_dump or its source code.

Tried to apply in database.php

'charset'  => 'cp1252', //  and also latin1 and utf8
'collation'=> 'Latin1_General_CI_AS', // both with this on/off 

Latin1_General_CI_AS is what is on SQL Server box

if i utf8_encode($varToDisplay) then will display alright!

but i'm struggling to find direct solution, not to be envcoding every time i make query!

did u have this trouble, or know solution??

Last updated 2 years ago.
0

Hi fRAiLtY-,

I followed your setup and confirmed FreeTDS is working on my server (no message error codes showed up) but I have a problem querying Eloquent models when using a browser. When I hit my app using a browser I get a SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9) error but when I use php artisan tinker and access my models there, it returns records just fine. Any idea?

I also posted this problem on stackoverflow.

0

@iboinas I'm facing the same problem... I don't wanna utf8_encode each single string I bring from database...

0

iboinas said:

Wow, you had the same problem as me!! :)

And exactly same solution!! Just I came later!!

Just wondering, i'm still facing a problem; standard connection setup, returns accented chars in result to come as � both on var_dump or its source code.

Tried to apply in database.php

'charset'  => 'cp1252', //  and also latin1 and utf8
'collation'=> 'Latin1_General_CI_AS', // both with this on/off 

Latin1_General_CI_AS is what is on SQL Server box

if i utf8_encode($varToDisplay) then will display alright!

but i'm struggling to find direct solution, not to be envcoding every time i make query!

did u have this trouble, or know solution??

andersonef said:

@iboinas I'm facing the same problem... I don't wanna utf8_encode each single string I bring from database...

@andersonef & @iboinas - I was facing the same problem, however, using these in the configuration solved it. In fact, adding either one of them fixed the problem.

'charset'  => 'UTF-8',
'collation'=> 'Danish_Norwegian_CI_AS'
Last updated 9 years ago.
0

First, run $ sudo apt-cache search phpyourphpversion-*

example : your php version is 7.0 $ sudo apt-cache search php7-*

Command : vagrant ssh We need to install the Sybase package for enabling the support for PDO and Mssql. Command : sudo apt-get install phpyourphpversion-sybase

example : your php version is 7.0 $ sudo apt-get install php7.0-sybase

0

Sign in to participate in this thread!

Eventy

Your banner here too?

fRAiLtY- frailty- Joined 8 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.