News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
SqlSrv v2 and long field names
October 25, 2010 @ 13:03:59

In this latest post to his blog Rob Allen takes a look at a problem he had when installing a project that used SQL Server as its data source - it just didn't work.

A good proportion of the projects my company undertakes end up on Windows servers with IIS and SQL Server and hence we use the SqlSrv PHP extension from Microsoft. We don't host any of these projects ourselves and leave it up to the client's IT department. This is the main reason that we use a database abstraction layer, Zend_Db, in our case as we can swap the underlying database out with less hassle. A couple of weeks ago, I came across a problem when installing our app onto the client's server. It didn't work. This was a surprise as we have a few Windows Server VMWare installations on which we had tested and they had worked fine.

He ultimately boiled it down to an exception from the SQL Server - "String data, right truncation". As it turns out, with the version 2 of the sqlsrv driver, you can't have a field name longer than 30 characters. There's two obvious workarounds - shorten the field name or use a PDO interface. Since one doesn't exist (well, not formally) he created his own you can drop into your application if you have the need.

0 comments voice your opinion now!
sqlserver sqlsrv driver pdo exception zenddb


blog comments powered by Disqus

Similar Posts

Gonzalo Ayuso: Handling several PDO Database connections in Symfony2 through the DIC in PHP

Ariz Jacinto's Blog: Compiling PHP with MSSQL Server's Native ODBC Driver for Linux as a PDO Driver

Juozas Kaziukenas' Blog: SQL Native Client as MSSQL driver for Zend Framework

James Fuller's Blog: Enforcing contracts in your PHP functions and methods

Christopher Jones' Blog: New PDO_OCI Attributes


Community Events

Don't see your event here?
Let us know!


release voicesoftheelephpant framework laravel development community library extension series laravel5 opinion unittest podcast conference language middleware interview introduction wordpress api

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework