on 2016 Jan 11 7:44 PM
I have SQL Anywhere 17.0.0.1062 running with PHP 5.5 under Ubuntu 14.04. It's working fine and I can connect successfully using
$conn = sasql_connect( "Server=mydb;DBN=mydb;UID=DBA;PWD=xxx" );However, I now want to setup it up to work with ODBC. First I created an ODBC connection with the command:
dbdsn -w mydb -c "Server=mydb;DBN=mydb;UID=DBA;PWD=xxx"That successfully creates a .odbc.ini file in my home directory (
/home/vagrant
).
[ODBC Data Sources] mydb=SQLAnywhere 17.0 [mydb] UID=DBA PWD=xxx ServerName=mydb Driver=/opt/sqlanywhere17/lib64/libdbodbc17.soAt this point I can use SQL Central and "Connect with an ODBC Data Source". That works.
However using PHP, the statement:
$conn = sasql_connect( "DSN=mydb" );fails to connect and gives the error
Warning: sasql_connect(): SQLAnywhere: [-95] Parse error: Cannot find .ini file in /usr/share/nginx/html/sasql_test.php on line 3I've tried defining
ODBCHOME=/home/vagrant
in /etc/environment
(and rebooting), but that doesn't have any effect.
What am I missing here?
Request clarification before answering.
There is something about this that doesn't add up correctly. The .odbc.ini is clearly present since SQL Central can find it and the search for that will automatically include your home directory.
Also since PHP can connect without it this does not seem to related to the environment not being set up correctly; so the generated sa_config.[csh|sh] must have been sourced already.
Maybe this has something to do with they way you launch your PHP runtime?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
20 | |
9 | |
8 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.