简体   繁体   English

使用PHP连接到odbc sage 100

[英]connect to odbc sage 100 using PHP

I want to connect To SAGE commerciale 100 using odbc sage with php : I've succeeded to connect only with MS Excel. 我想使用odbc sage和php连接到SAGE commerciale 100:我仅成功连接了MS Excel。 But with php I didn't 但是用PHP我没有

this my php code : 这是我的PHP代码:

try
{
   $conn = odbc_connect("Driver=SAGE Gestion commerciale 
   100;Server=localhost;Database=GestCom_Sage100;","username","password");
}
catch (PDOException $e)
{
   echo $e->getMessage();
} 

But I got this error : 但是我得到了这个错误:

 SQL error: [Microsoft][Gestionnaire de pilotes ODBC] Source de données 
 introuvable et nom de pilote non spécifié, SQL state IM002 in SQLConnect.

if I use new pdo instead of odbc_connect i got the same error 如果我使用新的pdo而不是odbc_connect,则会出现相同的错误

 $conn = new PDO("odbc:GestCom_Sage100","username","password");

The error could be caused because am in windows 10 64 bits and I am using 32-bits odbc sage ? 该错误可能是由于在Windows 10 64位中使用32位odbc sage吗?

I changed My code to : 我将代码更改为:

$dsn = "GestCom_Sage100";
$conn = odbc_connect($dsn,"username","password");

And I execute my code on windows 7 32 bits and it worked. 我在Windows 7 32位上执行我的代码,它起作用了。 The problem was that ODBC sage is a 32 bits application used on 64 bits OS. 问题是ODBC sage是在64位OS上使用的32位应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM