Connecting to an Advantage Database with PHP on Windows

人走茶凉 提交于 2019-12-25 05:17:08

问题


I have a customer that has an application that uses an Advantage Database. I am having problems trying to connect to it with PHP using ODBC or the PHP connector it get this discovery 6420 error which seems quite common.

I think most of the problem is my laack of understanding of the Advantage Database. I am thinking the problem may be there is actually no server running? do that application maybe have its own kind of server maybe? I have written a small C# program that connects to the data dictionary and reads it fine, but it uses this Advantage.data.provider for C#. Is that acting like a server?

So I guess the bottom line is: Is there a way to connect to this data dictionary/Advantage Database so I can access with PHP? (preferably without buying something)

Thanks for your help.


回答1:


NOTE: I have no affiliation with Advantage or Sybase (the parent company which owns Advantage); I used to work with Advantage regularly and have some experience, but in no way am associated with the company or product.

Advantage Database Server (ADS) runs in three different modes. By default, it runs in server mode(ADS_REMOTE_SERVER), which requires an Advantage Database Server instance be running that can be found by checking at a specific port (the port is configurable).

The second default mode is ADS_AIS_SERVER, which is the Advantage Internet Server. This allows remote connections to connect directly to an AIS instance via an internet connection; I've never used this version of ADS, so I can't comment on that mode.

The final mode is Local Server (not configured as a default connection type), in which case a local copy of the Advantage DLL is loaded and it runs using that local connection to access the data. In this mode, certain functionality is not available (transactions, for instance), and the number of connections is limited. Advantage Local Server is free for local use, and supports up to 5 connections (last I checked, anyway).

ADS has several ways to connect (ODBC, a .NET Data Provider, libraries for C, C#, Clipper, FoxPro, and a couple others), and supports both Windows and Linux on both the server and client level.

The mode is typically configured by an API call; I'm more familiar with using ADS through it's Delphi component implementation; via the API, it's ADSSetServerType that determines which mode is used (or combination of modes).

For ODBC, you configure the mode via the ODBC Configuration Screen (visible when using the normal ODBC administration utility in Windows Control Panel) - see the Available Server Types groupbox in the image below:

According to the documentation, you're correct about it being a discovery error. Have you checked the suggested solutions?

Problem: The Advantage application was unable to connect to the Advantage Database Server.

Solution: Several problems can cause this error to occur. Some common solutions are listed below. Reference the Advantage Knowledge Base for more detailed descriptions and a more complete list of known error cases.

  • Verify the Advantage Database Server is installed and running on the server where the database is located.

  • If attempting to use the Advantage Local Server and not the Advantage Database Server, make sure the application's "server types" setting is set to use the Advantage Local Server.

  • If using the Native SQL Utility in the Advantage Data Architect, and you desire to use the Advantage Local Server and not the Advantage Database Server, make sure the Advantage connection type is set to "Local (ALS)". This can be done via the Query Options dialog that is accessed by clicking the button that has the screwdriver, hammer, and wrench on it.

  • If the server is NetWare 5 or greater, make sure the version of the Advantage Database Server is 5.6 or greater, and make sure the Advantage client is v2.6 or greater.

  • If communicating to a server that only has IPX installed, make sure the Advantage client is enabled to send IPX packets.

  • If running through a firewall, make sure the Advantage IP send and receive ports are properly configured and opened up through the firewall.

(I was going to provide links to the documentation at the Sybase web site, but it appears to be off-line for maintenance right now; I'll update this answer tomorrow when it's back up or I have access to links bookmarked from my office PC.)



来源:https://stackoverflow.com/questions/9918003/connecting-to-an-advantage-database-with-php-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!