Technology and Community

Jim O'Neil

Subscribe to Jim O'Neil: eMailAlertsEmail Alerts
Get Jim O'Neil: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: Apache Web Server Journal

Apache Web Server: Article

EAServer Problem Analysis & Troubleshooting

Part art, part science Part 2

Java Connection Management (JCM) Tracing The JCM module in EAServer is responsible for managing the JDBC connection caches installed on the server. By setting the server property com.sybase.jaguar.server.jcm.trace to true, you can capture the loading sequence of these caches, the methods implemented by the JDBC driver and the internal EAServer APIs used to manage the caches during the server's operation.

The com.sybase.jaguar.server.jcm.trace.options property can also be set to include either or both of the following two comma-delimited options:

  • DisplayPrefix: Adds the string JCM as an eye catcher to the beginning of each trace line
  • DisplayThread: Adds a prefix describing the thread handling the request
This information may prove useful in configuration issues when one or more connection caches don't initialize or connect successfully. Be sure not to leave this option activated longer than necessary; besides slowing performance, the connection cache passwords are echoed to the EAServer log in clear text.

JDBCSpy DataDirect Technologies provides a JDBCSpy driver that can be used to intercept and report the JDBC API calls made by an application much like the ODBC driver trace does for ODBC applications. To use this facility, you create a connection cache using the driver name com.merant.jdbcspy.SpyDriver and embed the actual driver information in the URL for the JDBCSpy driver.

For example, to trace a connection to an ASA database running on the same machine as EAServer, you would set the server name property of the connection cache to this:

jdbc:spy:{jdbc:sybase:Tds:localhost:2638};
load=com.sybase.jdbc2.jdbc.SybDriver;
log=System.out;
logTName=yes

If you want to redirect the output to a file other than the EAServer log, specify something like log=(file)c: empjdbcspy.out instead of log=System.out in the URL.

Like ODBC tracing, interpreting JDBC trace output requires some knowledge of the JDBC API specification, which is available from the Sun web site. However, you will easily spot your SQL queries in the trace to guide your investigation.

Open Client Tracing
Ribo is a TDS capture tool provided free with jConnect for JDBC as well as the support section of the Sybase web site. It's an Open Server program written in Java that captures the traffic between a client application and a back-end server such as Adaptive Server Enterprise. Client applications connect to Ribo directly, and the Ribo server records the traffic in a log file before passing the request (or response) through to the targeted server or client.

To start the Ribo GUI interface, type the command ribo -gui in the directory containing the ribo.bat or ribo.sh command files. The RIBO_HOME environment variable must be set to this directory. As shown in Figure 6, the interface lets you enter three values:

  • Listen Port: The port number that the Ribo process is monitoring
  • Server Host: The machine hosting the targeted Open Server application (for example, Adaptive Server Enterprise)
  • Server Port: The port on which the targeted server is listening
The Server Host and Server Port values are taken from the interfaces (or SQL.INI) file for the server for which you originally created the connection cache. The connection cache itself would be changed to contain a new Server Name that must be added to EAServer's interfaces (or SQL.INI) file. That new Server Name corresponds to the Ribo process itself, which is often run on the same machine as EAServer (localhost) at a default port of 5005.

As connections to the targeted database server are routed through Ribo, trace files - one per connection - are recorded and optionally displayed via the Ribo interface. The captured files, which contain raw TDS output, can be translated to a readable ASCII format using the ribo command line as shown in the following example:

ribo cap8.tds cap8.txt

For the other command-line options, type ribo -h at a command prompt.

In terms of PowerBuilder components, Open Client caches are supported by the SYJ database driver interface. That driver officially supports access only to Adaptive Server Enterprise databases. Although technically you can use Open Client connection caches to access other Open Server programs such as DirectConnect for OS/390, using the SYJ driver in a PowerBuilder component to do so is neither supported nor recommended. The alternative is to use an ODBC or JDBC connection cache.

Another Word About Sanity Checks
Occasionally the connection cache sanity check mechanism itself will fail. For instance, the default statement SELECT 1 is not a valid syntax for databases such as Oracle. When sanity check fails, an error message is recorded in the server log with the distinctive preface cm_conlib, conlib for the connectivity library such as odbc or oci. For example, the following error occurred on a sanity check of a Microsoft SQLServer connection cache because there was no table named dummy in the SQLServer database:

Dec 21 14:03:15 2002: SPID: 14 cm__odbc_error: SQLError: 208, SQLState: S0002,
?[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dummy'

Although this particular issue is easily remedied by the com.jaguar.sybase.conncache. check property, other less obvious errors may occur. So it's important to distinguish connection cache maintenance errors from errors spawned by database activity in your actual business logic. Because a failed sanity check results in a new physical connection being established, the performance of your application can suffer as well, even if there are no discernable errors in its functionality.

Conclusion
Hopefully I have provided insight into the inner workings of the EAServer/PowerBuilder solution that you can leverage for more effective problem analysis and troubleshooting in your own environment.

This article is based on PowerBuilder 9 Internet and Distributed Application Development by various authors (ISBN 0672324997), published by Sams Publishing.

More Stories By Jim O'Neil

Jim is a Technology Evangelist for Microsoft who covers the Northeast District, namely, New England and upstate New York. He is focused on engaging with the development community in the area through user groups, code camps, BarCamps, Microsoft-sponsored events, etc., and just in general serve as ambassador for Microsoft. Since 2009, Jim has been focusing on software development scenarios using cloud computing and Windows Azure. You can follow Jim on Twitter at @jimoneil

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.