Connecting PHP with SQream ODBC

This article describes how to create a new connection to SQream via the PHP ODBC driver.

This article assumes you have a webserver with PHP installed on Windows. The Linux version should be similar, but requires installation of the unixODBC package.

Make sure php uodbc is enabled

Follow these instructions on PHP's documentation website

Create a sample connection for testing

Below is a sample PHP file you can use to test your connection. Make sure to edit in the required details, such as <your server address>, <your server port>, <your username> and <your password>

$dsn = "odbc:Driver={SQreamDriver64};Server=<your server address>;Port=<your server port>;Database=master;User=<your username>;Password=<your password>";
$conn = odbc_connect($dsn,'','',);
if (!($conn)) { 
  echo "Connection to DB via ODBC failed: " . odbc_errormsg ($conn );
$sql = "SELECT 1 as test, 2 as other_test";
$rs = odbc_exec($conn,$sql);
while ($row = odbc_fetch_object($rs)) 
    echo ($row->test . "," . $row->other_test);
    // ...

Open the webpage you just created using your browser

If everything is successful, you should see


If something else appears or you get an error, please contact SQream support.

  • 88
  • 01-Mar-2017