MySQL Workbench PHP ADODB connection MSSQL solve garbled problem

Source: Internet
Author: User
Tags interbase mssql server
Zhou Haihan/Wen
ADO can be used with new COM ("ADODB. Connection ", NULL, Cp_utf8)//65001 Such statements to achieve the correct conversion. However, ADO lacks documentation for PHP support. And there is an open source ADODB, the document is richer.
The method of setting UTF-8 for different database drivers is not the same, as follows:

Copy the Code code as follows:


For all drivers
' Persist ', ' persistent ', ' Debug ', ' Fetchmode ', ' new '
Interbase/firebird
' Dialect ', ' charset ', ' buffers ', ' role '
M ' Soft ADO
' Charpage '
Mysql
' Clientflags '
Mysqli
' Port ', ' socket ', ' clientflags '
Oci8
' Nls_date_format ', ' CharSet '
For all drivers
' Persist ', ' persistent ', ' Debug ', ' Fetchmode ', ' new '
Interbase/firebird
' Dialect ', ' charset ', ' buffers ', ' role '
M ' Soft ADO
' Charpage '
Mysql
' Clientflags '
Mysqli
' Port ', ' socket ', ' clientflags '
Oci8
' Nls_date_format ', ' CharSet '


Where ADO can use the Charpage property to set Uft-8, like the new COM way. However, it is found that when the Adonewconnection ($dbdriver) $dbdriver is set to ' ADO ' or ' Ado_mssql ', the database it passes in is replaced by provider. How does the database name be set? I've never found a way.
$dbdriver = ' ado://sa:cvttdev@172.16.22.40/sqloledb?charpage=65001 ';
The format is ' Driver://user:passwd@host/database?options[=value '
But the place where the database name is set is not resolved.
Pain for a long time, can only find the following ways to solve:

Copy the Code code as follows:







$dbdriver = ' Ado_mssql ';
$server = ' 192.168.22.40 ';
$user = ' sa ';
$password = ' passwd ';
$DATABASE = ' sugarcrm_db ';
$database = ' SQLOLEDB ';
$dbdriver = ' ado://sa:cvttdev@172.16.22.40/sqloledb?charpage=65001 ';
$myDSN = "Provider=msdasql;driver={sql Server}; server={172.16.22.40};D atabase=sugarcrm_db; Uid=sa; Pwd=cvttdev; ";
Include (' adodb5/adodb.inc.php ');
$db = Adonewconnection ($dbdriver); # eg ' MySQL ' or ' postgres '
$db->debug = true;
$db->charpage = 65001;
$db->connect ($server, $user, $password, $database);
$db->connect ($myDSN);
Error:mssql server not support codes below
$db->execute ("Set names ' UTF8 '");
echo "before query";
$rs = $db->execute (' select * from accounts ');
Print "



Print "
";
?>


The above describes the MySQL workbench PHP ADODB connection MSSQL solve garbled problem, including the contents of the MySQL Workbench, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.