cancel
Showing results for 
Search instead for 
Did you mean: 

Connectin to SQL Anywhere 16 from PHP 7.4.6

2,490

Hi to everyone!

I am trying to connect from an OpenSuse 15.3 Linux server, more precisely, from PHP Version 7.4.6 (Apache2 module) to SQL Anywhere Server Version 16.0.0.1948 on another machine in my LAN.

In the past I have been connecting to the same server from PHP 5.x, and this was easy because there was an PHP extension in the SQL Anywhere Client package. This extension is lacking for PHP 7.4.6, unfortunately.

What can I do?

In the PHP documentation (https://www.php.net/manual/en/intro.uodbc.php) it says:

"Introduction In addition to normal ODBC support, the Unified ODBC functions in PHP allow you to access several databases that have borrowed the semantics of the ODBC API to implement their own API. Instead of maintaining multiple database drivers that were all nearly identical, these drivers have been unified into a single set of ODBC functions. The following databases are supported by the Unified ODBC functions: » Adabas D, » IBM DB2, » iODBC, » Solid, and » Sybase SQL Anywhere. Note: With the exception of iODBC, there is no ODBC involved when connecting to the above databases. The functions that you use to speak natively to them just happen to share the same names and syntax as the ODBC functions. However, building PHP with iODBC support enables you to use any ODBC-compliant drivers with your PHP applications. More information on iODBC, is available at » www.iodbc.org with the alternative unixODBC available at » www.unixodbc.org."

This sounds as if I could connect using the PHP-ODBC-extension. But I have trouble getting things up and running. My questions:

1) Do I have to use unixODBC in addition to the PHP extension or is the PHP ODBC extension all I need? 2) There are some ODBC libraries in the SQL Anywhere 16 client package, see below. Do I have to use one of these? Which one? And how?

lrwxrwxrwx 1 root root      17  6. Jul 11:21 ../lib64/libdbjodbc16.so -> libdbjodbc16.so.1
-r-xr-xr-x 1 root root  766576  6. Jul 11:21 ../lib64/libdbjodbc16.so.1
lrwxrwxrwx 1 root root      18  6. Jul 11:21 ../lib64/libdbodbc16_n.so -> libdbodbc16_n.so.1
-r-xr-xr-x 1 root root 1500304  6. Jul 11:21 ../lib64/libdbodbc16_n.so.1
lrwxrwxrwx 1 root root      18  6. Jul 11:21 ../lib64/libdbodbc16_r.so -> libdbodbc16_r.so.1
-r-xr-xr-x 1 root root 1529328  6. Jul 11:21 ../lib64/libdbodbc16_r.so.1
lrwxrwxrwx 1 root root      16  6. Jul 11:21 ../lib64/libdbodbc16.so -> libdbodbc16.so.1
-r-xr-xr-x 1 root root  134696  6. Jul 11:21 ../lib64/libdbodbc16.so.1
lrwxrwxrwx 1 root root      22  6. Jul 11:21 ../lib64/libdbodbcansi16_r.so -> libdbodbcansi16_r.so.1
-r-xr-xr-x 1 root root 1525528  6. Jul 11:21 ../lib64/libdbodbcansi16_r.so.1
lrwxrwxrwx 1 root root      22  6. Jul 11:21 ../lib64/libdbodbcinst16_r.so -> libdbodbcinst16_r.so.1
-r-xr-xr-x 1 root root  509056  6. Jul 11:21 ../lib64/libdbodbcinst16_r.so.1
lrwxrwxrwx 1 root root      20  6. Jul 11:21 ../lib64/libodbcinst.so -> libdbodbcinst16_r.so
lrwxrwxrwx 1 root root      22  6. Jul 11:21 ../lib64/libodbcinst.so.1 -> libdbodbcinst16_r.so.1

3) Will the SQL Anywhere server accept ODBC connections at all? Do I have to configure this?

Any help or hint is appreciated!

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Breck, I love you! You made my day!

I don't know why I had not found that page.

Works like a charm.

Breck_Carter
Participant
0 Kudos

> why I had not found that page

Here's why: The page is located in a little-known area called the "SQL Anywhere Wiki".

I found it by starting here SAP Help Portal for SQL Anywhere 17 and then doing a This product search for php support.

That (almost) brought me to this page SQL Anywhere PHP Extension which has a link...

...to this off-site wiki page The SAP SQL Anywhere PHP Module.

Important points...

The V17 SAP Help Portal contains the most up-to-date Help, useful even if you are using earlier versions... new material appears here.

Always make sure you're searching This product because it has an annoying habit of switching to This document.

You can download all of the V17 Help as PDFs, one by one, by following the link from each Portal "book"... it takes forever, but nothing beats your local drive for safety.

VolkerBarth
Contributor

Searching within this forum with tag "php" might give the fastest answers, methinks.

Breck_Carter
Participant
0 Kudos

Show me how that gets you to the Wiki page that has the download link to get the PHP module.

Breck_Carter
Participant
0 Kudos

This page says PHP 7.4 is supported: The SAP SQL Anywhere PHP Module.