PDO Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

PDO Problem

Post by Ree »

When trying to access MS SQL DB using PDO, I get the following error:

SQLSTATE[HY000]: General error: 10007 Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. [10007] (severity 5) [SELECT * FROM Lessons]

How do I fix it?

Any help would be greatly appreciated.
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Error seems to indicate the library PHP has used for the PDO extension is outdated. Are you using PDO_ODBC or PDO_DBLIB?

Quotes from the PHP manual section on PDO_DBLIB:
This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.
...and more importantly...
On Windows, you should use the PDO_ODBC driver to connect to Microsoft SQL Server and Sybase databases, as the native Windows DB-LIB is ancient, thread un-safe and no longer supported by Microsoft.

Some additional information would help, I'm sure:

Is PHP on a Windows or UNIX server? What server version? What PHP version?
Is this on your own server or a hosting company? Have you contacted their tech support?
Have you been / are you successful in using the same SELECT statement by other methods other than PDO?

Please note I have never worked with this specific PDO driver nor have I ever worked with MS SQL, just trying to help.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Thank you, I tried with ODBC, and the error disappeared, however, another problem now occurs which I posted here.
Post Reply