Ticket #1572 (closed defect: fixed)

Opened 9 months ago

Last modified 7 months ago

Connecting with to SQL server with ODBC

Reported by: jphilip Owned by: jwage
Priority: major Milestone: 1.0.6
Component: Connection Version: 1.0.3
Severity: Keywords:
Cc: Has Test: no
Status: Pending Core Response Has Patch: yes

Description (last modified by jwage) (diff)

The DB-Library that the current MSSQL adapter uses has a lot of problems and is not going to be supported in future versions of MSSQL. The PHP web site recommends using ODBC to connect to MSSQL, but I was not able to do it in Doctrine as it seems that the ODBC driver is not associated with a Doctrine_Connection implementation. I was able to connect with ODBC by associating ODBC with Doctrine_Connection_Mssql in the Manager openConnection method. (See patch) I also have to first create a PDO object and then pass it to Doctrine as ODBC allows passing a dsn without hostname and Doctrine does not. The following code works, but only with the joined patch as a quick fix:

$dbh = new PDO("odbc:localexpress"); $conn = Doctrine_Manager::getInstance()->connection($dbh, "db_import"); $conn ->setOption ('dsn', "odbc:localexpress");

Attachments

doctrine-manager01.patch (0.7 KB) - added by jphilip 9 months ago.
Patch to connect with ODBC

Change History

Changed 9 months ago by jphilip

Patch to connect with ODBC

Changed 7 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

(In [5308]) [1.0, 1.1] Adding odbc to list of drivers (closes #1572)

Changed 7 months ago by jwage

  • description modified (diff)
  • milestone changed from 1.0.5 to 1.0.6
Note: See TracTickets for help on using tickets.