dbTalk Databases Forums  

PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04

sybase.public.sqlanywhere.linux sybase.public.sqlanywhere.linux


Discuss PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 in the sybase.public.sqlanywhere.linux forum.



Reply
 
Thread Tools Display Modes
  #41  
Old   
Phil Mitchell
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-28-2008 , 10:29 AM






This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Quote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote in
message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC managers
are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting via
PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the directory
specified by the environment variable $ODBCINI, $ODBC_INI or $ODBCHOME. If
the environment variable doesn't already exist, you should probably add
one to your rc.d scripts or just place the .odbc.ini file in the home
directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you to
one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business decision
that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP with
support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF 10.0.1.3614
or higher. Our EBF downlaods page can be found in my signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step guid
to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #42  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM






Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #43  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #44  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #45  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #46  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #47  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #48  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #49  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
  #50  
Old   
Harry Schurink
 
Posts: n/a

Default Re: PHP-linux retrieving from ASA 9.0.2 on Ubuntu 8.04 - 05-29-2008 , 01:27 AM



Okay,
I guess that will not work ... Do you know how to set up the 64 bit libodbc?

Tia
Harry

"Phil Mitchell" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
This means you're loading a 32-bit libodbc into a 64-bit process.

Harry Schurink wrote:
Hello Phil an Jeff,

I have been trying your suggestions, Installed Unixodbc and set up the
odbc.ini etc.

Now i get an errormessage in the browser when trying to connect to a
database.

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][Driver Manager]Can't open lib
'/opt/sybase/SYBSsa9/lib/libdbodbc9.so' :
/opt/sybase/SYBSsa9/lib/libdbodbc9.so: wrong ELF class: ELFCLASS32, SQL
state 01000 in SQLConnect in /var/www/test.php on line 3

Any ideas?

TIA
Harry

"Jeff Albion (Sybase iAnywhere)" <firstname.lastname (AT) ianywhere (DOT) com> wrote
in message news:48371189$1 (AT) forums-1-dub (DOT) ..
Harry,

Also note that if you're planning to use "just" ODBC (e.g. ODBC Unified
functions) with PHP, you'll have to make sure that PHP is configured for
whichever driver manager you're planning to use.

*A driver manager is an "interface" that makes calls back to our ODBC
driver. PHP needs to be directed to a driver manager that it recognizes,
and must be compiled with support for that manager. Popular ODBC
managers are iODBC and unixODBC.

See the PHP documentation for details on compiling PHP with an ODBC
manager:

http://us3.php.net/manual/en/odbc.installation.php

Once you install your driver manager and configure PHP to use it, you'll
need to register our driver with the manager.

I'll give a quick (untested) sample on how to configure our driver with
unixODBC. ( http://www.unixodbc.org/ )

=====
1. Create a file "sqlany9.odbcinst"
2. Put in the file:

[Adaptive Server Anywhere 9.0]
Driver = /opt/SYBasa9/lib32/libdbodbc9.so

3. Register the driver (as root):

odbcinst -i -d -f sqlany9.odbcinst
=====


Now you can use Phil's suggestions on configuring a DSN and connecting
via PHP. (i.e. add the appropriate DSN entry to .odbc.ini in the
directory specified by the environment variable $ODBCINI, $ODBC_INI or
$ODBCHOME. If the environment variable doesn't already exist, you should
probably add one to your rc.d scripts or just place the .odbc.ini file
in the home directory of the user that runs apache).

Your next question on how to *USE* the ODBC Unified functions in PHP is
admittedly slightly beyond the scope of this forum, but I'll point you
to one of the user-contributed notes in the PHP docs that gives a quick
overview on the general format that your code should take:

http://us3.php.net/manual/en/functio...exec.php#53126

A (very) short (untested) demo:
=====
?php
$conn = odbc_connect("ASA 9.0 Sample", "dba", "sql") or die("Cannot
connect to database!);

$sql = "SELECT * FROM Customer";
$result = odbc_exec($conn, $sql);

// Loop over rows
while (odbc_fetch_row($result)){

// Loop over columns
for ($i=0; $i<odbc_num_fields($result); $i++){
echo odbc_result($result, $i) . "\t";
}
echo "\n";
}

odbc_close($conn);
?
=====


That all said, I'm not entirely sure that using "straight" ODBC is
"easier" for you to manage in PHP rather than just recompiling PHP with
SQL Anywhere support from the source code as Phil mentioned (See:
http://www.sybase.com/detail?id=1019698 ), but that's a business
decision that I'll leave up to you.

---
*Tip: For others viewing this thread, if you're trying to compile PHP
with support for SQL Anywhere 10 on UNIX/Linux, you must be on EBF
10.0.1.3614 or higher. Our EBF downlaods page can be found in my
signature.

See: http://search.sybase.com/kbx/changer...?bug_id=470999
---

Regards,

Harry Schurink wrote:
There seems to be a driver for connecting to asa, but that has to be
compiled for each php version, so that is not really an option. It
should work from any (recent) version.

I know there is some kind of odbc for linux, but that has not been
installed along with the database. The references tot this odbc on the
internet assume i know all the details about this matter on linux.
But I am not a linux guru so can anyone provide me a step by step
guid to accomplish this?

So how to setup the linux odbc driver and some examples on how to
retrieve data in a PHP program.
--
Jeff Albion, Product Support Analyst
Sybase iAnywhere

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation :
http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs :
http://downloads.sybase.com/swd/summ...&timeframe =0



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.