Chapter 6 Web Server Gateways
To use the TDS-tunnelling servlet, you need a Web server that supports the javax.servlet interfaces, such as Sun Microsystems, Inc.'s Java Web server. When you install the Web server, include the jConnect TDS-tunnelling servlet in the list of active servlets. You can also set servlet parameters to define connection timeouts and maximum packet size.
With the TDS-tunnelling servlet, requests from a client to the back-end server that go through the gateway include a GET or POST command, the TDS session ID (after the initial request), back-end address, and status of the request.
TDS is in the body of the request. Two header fields indicate the length of the TDS stream and the session ID assigned by the gateway.
When the client sends a request, the Content-Length header field indicates the size of the TDS content, and the request command is POST. If there is no TDS data in the request because the client is either retrieving the next portion of the response data from the server, or closing the connection, the request command is GET.
The following example illustrates how information is passed between the client and an HTTPS gateway using the TDS-tunneled HTTPS protocol; it shows a connection to a back-end server named DBSERVER with a port number "1234."
Query | POST/tds?ServerHost=dbserver&ServerPort=1234& Operation=more HTTP/1.0 |
Header | Content-Length: 605 |
Content (TDS) | Login request |
Query | 200 SUCCESS HTTP/1.0 |
Header | Content-Length: 210 TDS-Session: TDS00245817298274292 |
Content (TDS) | Login acknowledgment EED |
Query | POST/tds?TDS-Session=TDS00245817298274292&Operation=more HTTP/1.0 |
Header | Content-Length: 32 |
Content (TDS) | Query "SELECT * from authors" |
Query | 200 SUCCESS HTTP/1.0 |
Header | Content-Length: 2048 TDS-Session: TDS00245817298274292 |
Content (TDS) | Row format and some rows from query response |
To use the jConnect servlet for TDS-tunneled HTTP, you need:
Your jConnect installation includes a gateway subdirectory (jConnect 4.x) or gateway2 subdirectory (jConnect 5.x) under the classes directory. The subdirectory contains files required for the TDS-tunnelling servlet.
Copy the jConnect gateway package to a gateway subdirectory (jConnect 4.x) or gateway2 subdirectory (jConnect 5.x) under your Web server's servlets directory. Once you have copied the servlets, activate the servlets by following the instructions for your Web server.
When you add the servlet to your Web server, you can enter optional arguments to customize performance:
Enter the servlet arguments in a comma-delimited string. For example:
TdsResponseSize=[size],TdsSessionIdleTimeout= [timeout],Debug=true
Refer to your Web server documentation for complete instructions on entering servlet arguments.
jConnect determines when to use the gateway where the TDS-tunnelling servlet is installed based on the path extension of the proxy connection property. jConnect recognizes the servlet path extension to the proxy and invokes the servlet on the designated gateway.
Define the connection URL using this format:
http://host:port/TDS-servlet-path
jConnect invokes the TDS-tunnelling servlet on the Web server to tunnel TDS through HTTP. The servlet path must be the path you defined in your Web server's servlet alias list.
You can view information about active TDS sessions, including the server connections for each session. Use your Web browser to open the administrative URL:
http://host:port/TDS-servlet-path?Operation=list
For example, if your server is MYSERVER and the TDS servlet path is /tds, enter:
http://myserver:8080/tds?Operation=list
This shows you a list of active TDS sessions. You can click on a session to see more information, including the server connection.
You can use the URL described above to terminate any active TDS session. Click on an active session from the list of sessions on the first page, then click Terminate This Session.
You can set the SESSION_ID connection property so that, if necessary, you can resume an existing open connection. When you specify a SESSION_ID, jConnect skips the login phase of the protocol and resumes the connection with the gateway using the designated session ID. If the session ID you specified does not exist on the servlet, jConnect throws a SQL exception the first time you attempt to use the connection.
Netscape Enterprise Server 3.5.1 does not support the javax.servlet.ServletConfig.getInitParameters( ) or javax.servlet.ServletConfig.getInitParameterNames( ) methods. To provide the necessary parameter values, you need to replace calls to getInitParameter( ) and getInitParameterNames( ) with hard-coded parameter values in TDSTunnelServlet.java.
To enter the required parameter values in TDSTunnelServlet.java and use TDS tunnelling with Netscape Enterprise Server 3.5.1 on Solaris:
mkdir NSE_3.5.1_install_dir/plugins/java/servlets/gateway
cp -r $JDBC_HOME/classes NSE_3.5.1_install_dir/docs
<param name=proxy value="http://hostname/servlet/ gateway_name.TDSTunnel_Servlet_name">
Copyright © 2001 Sybase, Inc. All rights reserved. |
![]() |