Skip to Content.
Sympa Menu

freetds - [freetds] trouble with UTF-8 input data with mssql_bind

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Tomasz Kurkiewicz <tomasz.kurkiewicz AT rw-online.pl>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] trouble with UTF-8 input data with mssql_bind
  • Date: Mon, 07 Dec 2009 12:31:18 +0100

Hi,


I'm using FreeTDS 0.82 to execute a stored procedure on a MS SQL Server 2005. Unfortunately, I keep getting error messages while executing a stored procedure using mssql_bind.
Web server is Fedora 8, PHP 5.3.0, freetds 0.82, database server is called MSSQL.


While using the syntax:

EXECUTE [procedure name] [parameter values with leading N when any varchar data]

Everything goes OK.
Client encoding is UTF-8, parameters are all nvarchars, it fails on a first nvarchar parameter (look at freetds.log).

freetds.log says:
"Error converting characters into server's character set. Some character(s) could not be converted"
"The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 ("@user_agent"): Data type 0xA7 has an invalid data length or metadata length."

I have searched through the internet, but I found no solution, how to get it working by using mssql_bind() function. If any of you could help, I'll be grateful. If you'd like to have more information, please ask, I'll try to post it.


With regards,
Tomasz Kurkiewicz



Further information:

(ADODB error output):

(mssql): select @@TRANCOUNT ------------------------------------------------------------------------
------------------------------------------------------------------------
(mssql): SET TRANSACTION ISOLATION LEVEL SERIALIZABLE ------------------------------------------------------------------------
------------------------------------------------------------------------
(mssql): SET DATEFORMAT ymd ------------------------------------------------------------------------
------------------------------------------------------------------------
(mssql): BEGIN TRAN ------------------------------------------------------------------------
InParameter($stmt, $php_var='3237686', $name='id_uzytkownika', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='Mozilla/5.', $name='user_agent', $maxLen=110, $type=39);
InParameter($stmt, $php_var='windows', $name='os', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='firefox 3.x', $name='browser', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='1680x1050', $name='resolution', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='1,5', $name='javascript', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='1', $name='dhtml', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='1', $name='dom', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='', $name='sidebar', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='20090824', $name='gecko', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='', $name='svg', $maxLen=4000, $type=39);
InParameter($stmt, $php_var='1', $name='css2', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='1', $name='ajax', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='1', $name='popups_disabled', $maxLen=4000, $type=56);
InParameter($stmt, $php_var='', $name='cache_ssl_downloads', $maxLen=4000, $type=39);
------------------------------------------------------------------------
(mssql): sp_log_user_agent ------------------------------------------------------------------------

*Warning*: mssql_execute() [function.mssql-execute <https://192.168.1.56/adodb_test/function.mssql-execute>]: message: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 ("@user_agent"): Data type 0xA7 has an invalid data length or metadata length. (severity 16) in */var/www/include/adodb/drivers/adodb-mssql.inc.php* on line *769*

*Warning*: mssql_execute() [function.mssql-execute <https://192.168.1.56/adodb_test/function.mssql-execute>]: General SQL Server error: Check messages from the SQL Server (severity 16) in */var/www/include/adodb/drivers/adodb-mssql.inc.php* on line *769*

*Warning*: mssql_execute() [function.mssql-execute <https://192.168.1.56/adodb_test/function.mssql-execute>]: stored procedure execution failed in */var/www/include/adodb/drivers/adodb-mssql.inc.php* on line *769*
8016: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 ("@user_agent"): Data type 0xA7 has an invalid data length or metadata length.



freetds.conf:

[global]
# TDS protocol version
tds version = 4.2

# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
dump file = /tmp/freetds.log
debug flags = 0xffff

# Command and connection timeouts
; timeout = 10
; connect timeout = 10

# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 2147483648
client charset = utf-8

[MSSQL]
host = 192.168.1.7
port = 1433
tds version = 7.0
client charset = UTF-8


freetds.log I've uploaded to http://www.rw-online.pl/freetds.log









Archive powered by MHonArc 2.6.24.

Top of Page