Sabra
Sabra

Reputation: 197

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. But with php I didn't

this my php code :

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

 $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 ?

Upvotes: 0

Views: 778

Answers (1)

Sabra
Sabra

Reputation: 197

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. The problem was that ODBC sage is a 32 bits application used on 64 bits OS.

Upvotes: 0

Related Questions