Doctrine + Firebird via PDO - php

as everybody knows, Firebird is again added to official build of PHP, and has it's own PDO extension. I thought about connecting it with Doctrine2. Officialy, website of Doctrine2 project says that they don't support Firebird yet. But now it has own PDO extension, so maybe there is a way to use it?
Does anybody tried to connect Doctrine2 with PDO Firebird?

There are some open issues for the Doctrine DBAL extension for Firebird: http://www.doctrine-project.org/jira/browse/DBAL-95

Related

Doctrine2: DBAL connection to Sql-Server

Connecting to MSSQL using Doctrine2 on Unix
Im currently developing a project which uses Doctrine2 with PHP on an Ubuntu Server (x64). It's required to fetch data from a MSSQL-Server which is running externally.
Problem
Doctrine2 doesn't support the pdo_dblib driver, neither there's a support for sqlsrv on unix-like machines (sqlsrv is windows only). Being that given, it seems like Doctrine simply doesn't have a built-in support for MSSQL-Servers on unix-machines.
Solutions
These are solutions I tried without success.
1. Write own wrapper for pdo_dblib and integrate in doctrine's DBAL
I couldn't figure out how to write my own driver, platform and schema for doctrines DBAL neither found anything usefull in its docs or per google.
Actual Question
Is there any kind of support for MSSQL-Servers with Doctrine 2 without using Symfony or other third-party code ?
Your original solution is not actually that hard to achieve. I've run into this issue trying to connect to SQL Server using ODBC, which is one option for linux hosts, and the only change that I needed was in this file.
If you update that function and use a valid ODBC connection string instead, it will work just fine. Of course the Doctrine folks didn't make it easy by making that function private, so you'll either have to resort to editing your library or copy/pasting the entire SQL Server driver code.
That said, SQL Server support with ODBC is somewhat poor. For example, I've run into an issue where exceptions are thrown if you use bound parameters inside a subquery. Even though it works just fine with Microsoft's official driver which itself is based on ODBC. Go figure. If possible, copy your data to a more Linux friendly database and work with it there.

How to Use Mysql PDO driver with hacklang/hhvm

I am getting a pdo exception "could not find driver" when trying to access MySql through PDO using hacklang/hhvm (compiled today). I tried installing php5-mysql but I'm not even sure that is helpful because I'm not sure of the relationship between php and hacklang especially in terms of extensions. What can I do to get PDO working on hacklang?
Update:
I found this list of supported extensions:
https://github.com/facebook/hhvm/wiki/Extensions
PDO and MySql are both on there but should I be looking for mysql_pdo? Or is there some configuring I need to do?
I solved it merely by rebuilding from scratch per the advice on peoples on the IRC channel. I honestly don't know what went wrong.

CakePHP 2.2 MSSQL / PDO Alternatives?

We have a CakePHP 1.3 application that we're in the process of upgrading to 2.2.3. One of the requirements of our app is to be able to query into an MSSQL database of a separate application to do some authentication and to pull user data out.
After two wasted days of researching and harassing our webhost to install the PHP / PDO / MSSQL lib (we already have PDO for MySQL, sqlite and sqlite 2) it's staring to seem pretty grim.
TL;DR: We need to find a way to do PDO MSSQL queries under Linux.
Begin Rant:
The thing that's driving me crazy is this: The CakePHP devs BROKE MSSQL compatibility for the sake of making all their DB wrappers with PDO. If you had a 1.3 app on a Linux server that was happily connecting to MSSQL databases and want to upgrade it to 2.2, you will no longer be able to connect to that database because apparently using PDO is more important than ensuring that you don't destroy existing functionality for your users.
CakePHP 2.x Docs do NOT warn users of this pitfall, all they say is that you need PDO.
There should be a notice that PDO/MSSQL does not work under Linux, or there should be an alterantive to the Sqlserver.php datasource that's provided with stock CakePHP so that people upgrading their apps have a chance of getting their applications functional again under 2.2x
I am really steamed about this right now because I wasted a week of time porting things over from 1.3 to 2.2 and now it looks like I either have to manually write the queries and ignore CakePHP's great database abstraction, or I need to convert all my work BACK to 1.3 and give up all the new improvements in the latest version of CakePHP.
The trick is :
sudo apt-get install php5-sybase
For some reason extension is not called mssql
sybase worked fine for me
What you need to do is install the ODBC drivers from Microsoft and set up the odbc connection strings. The process can be a bit tricky but it does work, and the driver is stable.
You can then use $dbh = new PDO("odbc:CONNECTIONNAME", $user, $password); to connect through PDO.
Once that is sorted, I think you can still use the MSSQL data source but modifying the connection string.

Connecting to MongoDB using PDO driver

Will I be able to connect to this database using PHP's php_mongo.dll driver?
If so, could you please provide some sample code?
MongoDB requires its own driver.
In your case, the PHP driver is located here:
http://php.net/manual/en/book.mongo.php
The instructions for installing it are on that page. There is also some sample code.
I think that PDO is only for relational databases. There's no PDO driver for MongoDB.
There is list of databases which you can use with the PDO driver: http://php.net/manual/en/pdo.drivers.php. MongoDB is not among them.
You can use the PHP PDO OBDC library, if you install MongoDB BI Connector and MongoDB ODBC Driver for BI Connector.
I haven’t tried it, but I’m about to - keep you posted.
https://www.mongodb.com/download-center/bi-connector
https://docs.mongodb.com/bi-connector/master/reference/odbc-driver/

PHP ORM with support for SQL Server 2005

I have been looking around the current options (and related SO questions) regarding PHP ORM solutions, however I have a couple of unique requirements:
I am running PHP on Windows Server 2003
I need to interface with SQL Server 2005
I can't seem to find a simple answer from the PHP ORM solutions out there as to which (if any) support MSSQL as an adaptor option. Outlet seems to support this, for instance, but is only mentioned in passing on the documentation page, while other references say that the current version (1.0) has only been tested with MySQL.
At the moment, I am using the Microsoft PHP SQL Server driver, which as I understand it, can't be used with current ORM solutions until the driver itself supports PDO (which the team are looking into, but with no timeframe).
So what can I use today as an ORM solution on PHP for Windows that interfaces with SQL Server. Anything out there at all?
From Doctrine manual:
The currently supported PDO database drivers are:
fbsql FrontBase
ibase InterBase / Firebird (requires PHP 5)
mssql Microsoft SQL Server (NOT for Sybase. Compile PHP --with-mssql)
mysql MySQL
mysqli MySQL (supports new authentication protocol) (requires PHP 5)
oci Oracle 7/8/9/10
pgsql PostgreSQL
querysim QuerySim
sqlite SQLite 2
And PHP on Windows should ship with an appropriate extension for MSSQL for PDO. Just enable
extension=php_pdo.dll
extension=php_pdo_mssql.dll
Propel should also support MSSQL, as it is written on top of PDO. And while not a full fledged ORM as such, Zend_Db has an adapter for MSSQL as well. The latter uses pdo-dblib though.

Categories