Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Unable to connect to MS SQL DB Using PDO DBLib within a controller.
  • If I connect using PDO (Not DB Classes) in a page under public I have no issue connecting to a MS SQL Server DB.

    If I put that same code in a Controller, and I receive a packet error on the DB server. (below)

    The login packet used to open the connection is structurally invalid, the connection has been closed. Please contact the vendor of the client library.

    Error: 17832 Severity: 20 State: 9

    I found a post on StackOveflow with the same problem, but not solution.

    http://stackoverflow.com/questions/12643420/pdo-adaptive-server-connection-failed-when-connecting-to-mssql-server-in-fuelphp/24590285#24590285
  • It might have something to do with the (version of) the library that PDO uses to connect to MSSQL?

    Or some server setting that is incompatible? If you google for "Error: 17832 Severity: 20" you get quite a lot of hits, also from non-PHP environments.

    When you run that code in a controller, did you already have had a DB connection by then? Like for example a session? In other words, maybe it's some PDO initialisation in our PDO driver that conflicts?
  • The PDO Driver for MSSQL, pdlib, seems to be very old (2005).  I was using PDO so I could use Fuel's DB classes.

    Perhaps I will just use PHP's mssql instead.   I take it there is no support that I can tell within fuel for it correct?

  • You seen the notes here: http://www.php.net/manual/en/mssql.requirements.php ? So there is an updated dblib available, but you need to install that manually.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion