PHP ODBC driver for mac os - php

i need to connect to ms sql server using odbc_connect.
this is line for connection in my get_conn function
self::$conn = odbc_connect($data['server'], $data['username'], $data['password']);
this is how i execute queries in my app
$rs = odbc_exec(self::get_conn(), $query);
On my windows 10 machine this worked just fine, after i have installed odbc driver for php, but i cant find the odbc driver for mac os.
Error Message
Fatal error: Uncaught Error: Call to undefined function odbc_exec()
Have someone have used this odbc functions on mac os, and how did u configure it?

Related

PHP 64 bit - Teradata ODBC driver failure - system error 126 'specified module cannot be found' -

I have installed PHP 5.6.30 64 bit on Windows Server 2012 along with Teradata ODBC driver.
Whenever I test the PHP connection I receive an error
Warning: odbc_connect(): SQL error: Specified driver could not be loaded due to system error 126: The specified module could not be found. (Teradata, C:\Program Files\Teradata\Client\15.00\ODBC Driver for Teradata nt-x8664\Lib\tdata32.dll)., SQL state IM003 in SQLConnect
EDIT: C:\Program Files\Teradata\Client\15.00\ODBC Driver for Teradata nt-x8664\Lib\tdata32.dll does definitely exist on that specific path. Also, using tdxodbc.exe to test the ODBC connection works normally using tdata32.dll, so it appears to be some issue with PHP.
I have installed Teradata ODBC via GSS > ICU > ODBC from the Utilities package based on a related thread however still experiencing the same error. I can make a successful 32-bit ODBC connection via SQL assistant. I have tried a DSN / DSN-less ODBC connection via PHP but same error occurs.
I have been unable to find any clear indication of what the issue is - any idea?

How to connect from cakePHP3 to MSSQL Server

(I develop on a Windows System with XAMPP and use cakePHP3)
I want to connect from my cakePHP3 Localhost application, to a external SQL Server (installed on a external Windows Server 2012 r2).
In my app.php I config my Server and that is how I test the connection:
try {
$connection = ConnectionManager::get('sqlServer');
$connected = $connection->connect();
}catch (Exception $connectionError) {
echo "not";
}
echo "connected";
On testing I get this error:
A Database connection using was missing or unable to connect.
The database server returned this error: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712
So I go to my Server and Installed the needed extensions (ODBC Driver 11 for SQL Server). But I get still the same Error.
Is it possible to connect to the external Server from Localhost? Or did I make a mistake?

Error connecting to MSSQL using PHP

I am receiving an error as below:
PHP Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]SQL Server
Network Interfaces: Connection string is not valid [87]. '
My codes are as follow:
$this->link = new PDO(
"sqlsrv:server=$this->serverName:$this->port;Database=$this->db",
"$this->uid",
"$this->pwd"
);
I wish someone can enlighten me on what is causing this error. Before that I was using dblib instead of sqlsrv.
"dblib:host=$this->serverName:$this->port;dbname=$this->db"
I am using XAMMP with Apache 2.4.12 and PHP 5.5.24 (they are all x86). I have php_pdo_sqlsrv_55_ts.dll and php_sqlsrv_55_ts.dll. I am also using Microsoft ODBC Driver 11 for SQL Server-x64.
Change it to:
$this->link = new PDO(
"sqlsrv:Server={$this->serverName},{$this->port};Database={$this->db};",
$this->uid,
$this->pwd
);
The default SQL Server port is 1433. Note the curly brackets, they allow for class variables.

MS Access DB in php 64bit SQL state IM002 error

I'm trying to fetch data from access db in php. Code works fine for 32 bit php( I've tested in php version>5), but code generates error for 64bit php wamp.
Error Message: Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in
What I've tried : How can I correct this error: Data source name not found and no default driver specified
Code :
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$db", "","");
$tabs = odbc_tables($connection);
Is there any solution or I've to install 32 bit version?
Microsoft Access Driver (*.mdb)
refers to the older Access "Jet" driver which is installed as part of Windows itself but is only available to 32-bit applications. (There is no 64-bit version of Jet.)
You could download and install the 64-bit version of the newer Access Database Engine (a.k.a. "ACE", available here) and then use
Microsoft Access Driver (*.mdb, *.accdb)
as the driver name. (Assuming that the WAMP server does not already have a copy of Access 2007 or later installed on it.)

Connect PHP to UniVerse ODBC DSN

I have what seems a simple question, but I just cant get php to connect to my ODBC DSN.
I have a webserver with an ODBC DSN configured properly, I can test the connection and it works just fine.
I am now trying to connect PHP to this DSN.
MYDSNNAME is using the driver: UniVerse 64-Bit ODBC Driver.
Here is my php code:
$conn=odbc_connect('MYDSNNAME','username','password',SQL_CUR_USE_ODBC);
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$sql="SELECT * FROM customers";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
dbc_close($conn);
I am getting the following error:
Message: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect
I have tried using the 64bit ODBC administrator and that did not work. Any suggestions would be great.
Thanks
I was able to circumvent the error I was getting by using the 32bit version of the driver within my ODBC Administrator and I am now connecting just fine.
It gets a little tricky with 32/64bit versions of the odbc administrator.

Categories