ODBC in PHP to connect to ServiceNow
ODBC in PHP to connect to ServiceNow
(OP)
I have access to ServiceNow via ODBC. Driver is installed since ages, I've been running queries and getting results since ages.
I have PHP installed on my server and I want to use it to connect via odbc to ServiceNow.
I've tried many things, including php scripts like the one below:
I'm getting the following warnings:
I'm using DataDirect OpenAccess SDK Local ODBC Driver and below are my current ODBC settings for ServiceNow:
Any help and any clue on how to solve this is very much appreciated.
Thanks.
I have PHP installed on my server and I want to use it to connect via odbc to ServiceNow.
I've tried many things, including php scripts like the one below:
CODE --> php
<?php #DSN "mydb" with a user and password $connect = odbc_connect("ServiceNow", "myusername", "mypassword"); # query the users table for name and surname $query = "SELECT * FROM incident"; # perform the query $result = odbc_exec($connect, $query); # fetch the data from the database while(odbc_fetch_row($result)){ $name = odbc_result($result, 2); print("$name\n"); } # close the connection odbc_close($connect); ?>
I'm getting the following warnings:
CODE -->
Warning: odbc_connect(): in C:\xampp\htdocs\odbc.php on line 3 Warning: odbc_exec() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\odbc.php on line 9 Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in C:\xampp\htdocs\odbc.php on line 12 Warning: odbc_close() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\odbc.php on line 18
I'm using DataDirect OpenAccess SDK Local ODBC Driver and below are my current ODBC settings for ServiceNow:
CODE -->
Data Source Name: ServiceNow Description: ServiceNow Service Name: ServiceNow_ODBC Service Data Source: ServiceNow Custom Properties: url=https://servicenowserver.service-now.com
Any help and any clue on how to solve this is very much appreciated.
Thanks.
RE: ODBC in PHP to connect to ServiceNow
Tom Morrison
Hill Country Software