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

It look You can .. check out http://laravel.com/docs/4.2/database

I know that SqlSrv means Microsoft SQL Server..

0

Laravel works fine with MS SQL Server. Microsoft provides a driver for PHP (several, actually, depending on your SQL version) which you install and enable in your PHP installation.

http://www.microsoft.com/en-nz/download/details.aspx?id=20098

0

Ok thanks, does this still apply, even if im using Laravel from a on a linux installation? I guess I should have mentioned that from the start :)

Last updated 9 years ago.
0

No it doesn't - Microsoft's drivers are for Windows-based servers. I seem to recall someone once mentioning FreeTDS - but I don't really know how that works.

I found an old thread that discussed a few options - but it is several months old: http://laravel.io/forum/06-04-2014-laravel-on-opensuse-connecting-to-microsoft-sql-server

Last updated 9 years ago.
0

Thanks man. I have spent some hours trying with FreeTDS + unixodbc, but with no working solution (yet). I will debug more and possibly open another thread with all the details if that does not work :]

0

Update:

I managed to get it work. This was done on a CentOS installation. I'll post what I did. Maybe it will help others.

I made sure that FreeTDS and unixODBC was working. By following step 4-6 at this link you can see how to install/test odbc (ignore the perl stuff). Then in app/config/database.php I added:

		'sqlsrv' => array(
			'driver'   => 'sqlsrv',
			'host'     => 'just_the_hostname_here',
			'username' => 'username',
			'password' => 'pw',
			'database' => 'db_name',
			'prefix'   => '',
		),

..and it works.

Remember to set $connection = 'sqlsrv' in relevant models.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.