You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by David Rekowski <da...@gmx.de> on 2008/06/25 10:43:02 UTC
Problem connection to derby with PHP using PDO or ibm_db2 (Linux)
Hello list!
My aim is to get PHP to connect and work with Apache Derby. (See end of
message for system and versions)
I tried to follow Dan Scotts slightly outdated tutorial from
http://coffeecode.net/archives/16-Apache-Derby-tutorial-OSCON-2005-materials.html
PDO works for example with mysql, but when I try to connect to derby via
PDO like this
$DSN = "DRIVER={IBM DB2 ODBC
DRIVER};PROTOCOL=TCPIP;DATABASE=MYDB;HOSTNAME=localhost;PORT=1527";
$dbh = new PDO("odbc:$DSN");
I get the following error:
SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data
source name not found, and no default driver specified
Derby is started and states:
DRDA_SecurityInstalled.I
Apache Derby Network Server 10.3.1.4 - (561794) wurde gestartet und ist
seit 2008-06-25 08:24:44.666 GMT bereit, Verbindungen am Port 1527 zu
akzeptieren.
(sorry for the localized output)
I also tried to connect via db2_connect, which results in this error:
[IBM][CLI Driver] SQL10007N Message "0" could not be retrieved. Reason
code: "3". SQLCODE=-1390"
However, I can connect to the database using ij:
connect 'jdbc:derby://localhost:1527/MYDB';
I couldn't find anything closely related in the mailing list archive and
google wasn't a great help either; most hits were related specifically
to DB2.
Any hints and help are greatly appreciated.
---
System:
Ubuntu 8.04 (x86)
Derby 10.3.1.4
Apache 2
PHP 5.2.4
ibm_db2 1.6.6 r1.75
pdo_odbc is unixODBC
--
David Rekowski
mailto:david.rekowski@gmx.de
Re: Problem connection to derby with PHP using PDO or ibm_db2 (Linux)
Posted by Dy...@Sun.COM.
David Rekowski <da...@gmx.de> writes:
> Hello list!
>
> My aim is to get PHP to connect and work with Apache Derby. (See end of
> message for system and versions)
>
> I tried to follow Dan Scotts slightly outdated tutorial from
> http://coffeecode.net/archives/16-Apache-Derby-tutorial-OSCON-2005-materials.html
>
>
> PDO works for example with mysql, but when I try to connect to derby via
> PDO like this
> $DSN = "DRIVER={IBM DB2 ODBC
> DRIVER};PROTOCOL=TCPIP;DATABASE=MYDB;HOSTNAME=localhost;PORT=1527";
> $dbh = new PDO("odbc:$DSN");
Have you actually downloaded and installed the DB2 ODBC driver on your
system? It doesn't come with Derby, and last time I checked it was only
distributed as closed source, and only for certain platforms...
It was available on Linux, but you needed root access to install it, if
I remember correctly.
The DB2 ODBC driver should work with a Derby Network Server as they both
use the DBMS-indpendent DRDA protocol...
--
dt