[DBAL-60] OCI8Connection couldn't connect when charset parameter specified Created: 09/Nov/10 Updated: 29/Dec/12 Resolved: 11/Nov/10 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Drivers |
| Affects Version/s: | 2.0.0-BETA4 |
| Fix Version/s: | 2.0.0-RC1-RC3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Miloslav "adrive" Kmet | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PHP Version 5.3.3-1ubuntu9, OCI8 1.4.1, Oracle 10.2.0.4.0 |
||
| Description |
|
When I am trying to connect to Oracle instance with another charset then specified in my environment variable NLS_LANG I got an error. $connectionOptions['oracle'] = array(
'driver' => 'oci8',
'dbname' => 'BOOK',
'user' => 'doctrine',
'password' => 'doctrine',
'charset' => 'AL32UTF8',
);
$em = EntityManager::create($connectionOptions['oracle'], $config, $evm);
$em->getConnection()->connect();
Produce error messages:
There is bug in OCI8Connection::errorInfo() and ::errorCode(). When oci_connect failed, it returns a boolean - false. but oci_error() accepts only resource as parameter. Therefor it is neccessary to check, whether $this->_dbh is resource. When I've fixed the error handling, I've got the right error, why I couldn't connect to Oracle:
That's because oci_connect accepts as connection string only TNS name, or Oracle Connection string. But ;charset=* in TNS name or connection string is invalid. oci_connect has 4th parameter charset for that purpose. |
| Comments |
| Comment by Miloslav "adrive" Kmet [ 09/Nov/10 ] |
| Comment by Benjamin Eberlei [ 11/Nov/10 ] |
|
Fixed |
| Comment by Ruslan [ 29/Dec/12 ] |
|
Can you help me. I'm having same problem. But your link doesn't work. |
| Comment by Miloslav "adrive" Kmet [ 29/Dec/12 ] |
|
You must have very old source code. The bug was fixed 2 years ago. Just compare your OCI8 driver with https://github.com/doctrine/dbal/tree/master/lib/Doctrine/DBAL/Driver/OCI8 |