I have installed the CONNX Unix client on a Linux machine. The license server runs on the same machine and I am using unixODBC as the driver manager.
I have created the ODBC.INI and ODBCINST.INI files, started the license server, and successfully run isql using the DSN defined in ODBC.INI. I can retrieve data through the Adabas SQL Gateway using the cdd files I have moved to the Linux box, using the isql command.
However, when I try to access the file from a php page using odbc_connect, I get the following message:
Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC]You are not licensed for any databases., SQL state 08001 in SQLConnect in /usr/apache/htdocs/test2.php on line 15
couldn’t connect
php page is very simple:
ODBC Test
<?php
// connect to a DSN "TAMIS-ADA-DEV" with a user and password "TAMIS-DEV"
$connect = odbc_connect("TAMIS-ADA-DEV", "TAMIS-DEV", "TAMIS-DEV") or die ("couldn't connect");
// query the users table for name and surname
$query = "SELECT * FROM [dbo].[TLC_TAM_ENTITY] WHERE ISN_TLC_TAM_ENTITY < 10";
// perform the query
$result = odbc_exec($connect, $query);
// fetch the data from the database
while(odbc_fetch_row($result)){
$suid = odbc_result($result, 1);
$uid = odbc_result($result, 2);
$gid = odbc_result($result, 3);
$name = odbc_result($result, 4);
print(“$name|$suid|$uid|$gid\n”);
}
// close the connection
odbc_close($connect);
?>
On the LINUX machine -
o is there a location specific for environment variables to be defined so the web server can pick them up?
o does the web server account have permission to open the connxreg.db ?
Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC]Creation of Information Schema failed. CDD probably locked by another user., SQL state 08001 in SQLConnect in /usr/apache/htdocs/test2.php on line 15
couldn’t connect
I have no idea why the cdd file would be locked. Perhaps this is indicative of a different problem?
In case anyone else has the same problem, CONNX have solved it!
Apparently, SQL Gateway writes some sort of small file, a schema or something like that, to the current directory. In my case this was the directory of my php page usr/apache/htdocs.
Apache was running under the daemon id and so this id needs write access to the “local directory”.
Hope this helps someone else. If anyone requires more details then feel free to contact me.
Hello I have a similar problem with php and connx.
I am using unixODBC and I can retrieve data through the isql but when I try from a php program I get this error:
Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC]CreateInfoSchemas: Unable to connect to the CONNX Schema connection database., SQL state 08001 in SQLConnect in /desarrolloweb/pbancosdesar/sicon/conectaodbc.php on line 12
I tried to set the variable where is the connxregistryfile but nothing.