1827283 Members
3475 Online
109717 Solutions
New Discussion

Re: Newbe PHP

 
Wim Van den Wyngaert
Honored Contributor

Newbe PHP

Hi,

I installed WASD + PHP on VMS. Now I would like to access a Sybase database with odbc_connect but I have problems with it.

Where/how do I configure odbc (the dsn) ?

Wim
Wim
11 REPLIES 11
Martin Vorlaender
Honored Contributor

Re: Newbe PHP

Hi Wim,

I wouldn't say I'm a PHP expert, but does http://www.php.net/manual/en/function.odbc-connect.php help?

cu,
Martin
Wim Van den Wyngaert
Honored Contributor

Re: Newbe PHP

Martin,

That is the page explaining the connect. The first parameter is the DSN that is looked up in odbc.ini.

1) where do I put odbc.ini and what must be in it ?
2) I now get "sql state unsup in sqlconnect" while all comments make me believe that it is supported. So, did I do something wrong ? Do I have to link Sybase with php ?

Wim
Wim
Martin Vorlaender
Honored Contributor

Re: Newbe PHP

Wim,

IIRC (and I'm no ODBC expert either) the DSN connection string should be something along the lines of

"Driver={Sybase SQL Server};Srvr=MyServer;DB=MyDatabase"

See http://sybooks.sybase.com:80/onlinebooks/group-cnarc/cng1000e/odbc_ref/@ebt-link;pt=58;lang=de?target=%25N%13_624_START_RESTART_N%25#X

cu,
Martin
Robert Atkinson
Respected Contributor

Re: Newbe PHP

Wim, I'd try putting the question on the WASD list (info-wasd@vsm.com.au) as well.

Mark Daniel is usually very good at answering queries.

Rob.
Wim Van den Wyngaert
Honored Contributor

Re: Newbe PHP

Rob,

I'll try it. But he says somewhere that he "just did the porting".

Wim
Wim
Wim Van den Wyngaert
Honored Contributor

Re: Newbe PHP

I would like to repeat the question for mysql : what do I do to use mysql ???
Do I need to install something extra ?

Wim
Wim
Craig A Berry
Honored Contributor

Re: Newbe PHP

Wim,

If you want to use ODBC as a client, then you need two pieces of client software, specifically an ODBC driver manager and then an ODBC driver specific to each database you want to access. This is true on any platform and has nothing to do with PHP or WASD per se.

Does PHP have its own ODBC driver manager and/or drivers included? If not, you'll need to acquire them and figure out how to build, install, and configure them. There are a number of commercial solutions, such as those from Attunity, OpenLink, and Easysoft. As far as I know all require a proprietary service running on the target server rather than having a database-native driver on the client side.

There are driver managers and native drivers that are both open source and free, but you'll need to build several pieces and figure out how to fit them all together. I've successfully tested the unixODBC driver manager on VMS; download it from http://www.unixodbc.org and give it a try. It comes with drivers for PostgreSQL and MySQL. I'm not sure the MySQL one has been ported yet but it shouldn't be too hard.

I've also used unixODBC successfully with FreeTDS, a driver that allows access to both Sybase and MS SQL Server databases. See http://www.freetds.org .
Wim Van den Wyngaert
Honored Contributor

Re: Newbe PHP

Craig,

That is how I understand it too.

But in the php.ini there is a note saying "Note that Mysql and ODBC support is now built in, so no dll is needed for it". (in comment too : "Windows Extensions", so, not valid for VMS ?)

But until I added extension=php_mysql.exe and
extension=php_odbc.exe (in php.ini) there was nothing about odbc and php in php_info. Now there is but I still get the same message.

So, what did I install/activate : the driver or the driver manager ?

Wim
Wim
Craig A Berry
Honored Contributor

Re: Newbe PHP

Ah, your original question was about Sybase, but it seems now you are more interested in MySQL. I'm assuming you are using CSWS_PHP v1.2, which is the first version that includes MySQL support. See:

http://h71000.www7.hp.com/openvms/products/ips/apache/csws_php.html

Does WASD support this or does it provide its own version of PHP?

As far as I can tell, the MySQL extension has nothing to do with ODBC, but is rather a custom interface specific to the MySQL database:

http://us2.php.net/manual/en/ref.mysql.php

There also appear to be Oracle extensions that have nothing to do with ODBC. There is no reason you can't access Oracle or MySQL through ODBC, but it looks like you have a choice.

The ODBC extension is probably neither a driver nor a driver manager, but rather the glue between PHP itself and the driver manager. The PHP documentation is confused and confusing because it refers to both drivers and driver managers as "databases" but see

http://us2.php.net/manual/en/ref.uodbc.php

It looks as though there are several drivers that can be linked in directly, bypassing the driver manager. That would likely give a slight performance advantage at a great loss of flexibility.

I really don't think there's a way to use ODBC without configuring and building PHP with support for a driver manager and/or driver. The good news is that OVMS Engineering appear to have done this already, if you look at the section called "ODBC Extension" in the release notes:

http://h71000.www7.hp.com/openvms/products/ips/apache/csws_php_relnotes.html

The bad news is that the driver manager they are using and for which they provide the example is from the Attunity Connect on platform package. If all you want to do is access local RMS files then you're all set, but I think for any remote databases you have to buy a server license from Attunity.

I would be strongly tempted to point the logical APACHE$ODBC_SHR to a different driver manager (such as unixODBC mentioned previously) and see what happens. I have no idea how WASD is supporting PHP so I don't know how applicable this is to your situation.
Wim Van den Wyngaert
Honored Contributor

Re: Newbe PHP

Craig,

I found the same documents. And I found an expert a few meters from me that explained that MYSQL can also be used directly in PHP without ODBC. So I mixed up things. Thank you for clarifying it.

WASD links with libraries of CSWS-php to do the work (which you don't install but re-use). So I guess it does about the same.

So, next week I'll give it a try.

Wim
Wim
labadie_1
Honored Contributor

Re: Newbe PHP

It seems you need the latest Mysql extension for Php at

http://www.pi-net.dyndns.org/anonymous/kits/axp/php_mysql_mysql_413.zip

Phpbb is used without problems by the author