Class XmlOdbc

java.lang.Object
  |
  +--XmlOdbc

public class XmlOdbc
extends java.lang.Object

The XmlOdbc class is used to communicate with the Easysoft XML-ODBC Server.

It allows you to send SQL statements to an ODBC driver on the same machine as the XML-ODBC Server and retrieve the results in XML. The protocol used is simple and documented by the DTDs distributed with the XML-ODBC Server.


Constructor Summary
XmlOdbc()
           
 
Method Summary
 void connect(java.lang.String server)
          Establishes socket connection to the XML-ODBC Server; Port defaults to 8895.
 void connect(java.lang.String server, int port)
          Establishes socket connection to the XML-ODBC Server
 java.io.DataInputStream getStreamResponse()
          Get XML response from the server as an input stream that can be passed to a parser.
 java.lang.String getStringResponse()
          Get XML response from the server as a String
 void sendRequest(java.lang.String sql, java.lang.String odbcConnectionString)
          Construct a request in XML and send it to the server.
 void sendXml(java.lang.String xmlrequest)
          Send XML request to the server given as a String parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlOdbc

public XmlOdbc()
Method Detail

connect

public void connect(java.lang.String server)
             throws java.net.UnknownHostException,
                    java.io.IOException
Establishes socket connection to the XML-ODBC Server; Port defaults to 8895.
Parameters:
server - XML-ODBC Server machine

connect

public void connect(java.lang.String server,
                    int port)
             throws java.net.UnknownHostException,
                    java.io.IOException
Establishes socket connection to the XML-ODBC Server
Parameters:
server - XML-ODBC Server machine
port - Port on which the XML-ODBC Server is listening

sendRequest

public void sendRequest(java.lang.String sql,
                        java.lang.String odbcConnectionString)
                 throws java.lang.Exception
Construct a request in XML and send it to the server. Establish connection to an ODBC data source on the machine on which the XML-ODBC Server is running using the connection string supplied, and executes given SQL. The result set generated can be retrieved as a string using getStringResponse() or as an input stream using getStreamResponse()
Parameters:
sql - SQL query to be sent to the XML-ODBC Server
odbcConnectionString - connection string

getStringResponse

public java.lang.String getStringResponse()
                                   throws java.lang.Exception
Get XML response from the server as a String

getStreamResponse

public java.io.DataInputStream getStreamResponse()
                                          throws java.lang.Exception
Get XML response from the server as an input stream that can be passed to a parser.

sendXml

public void sendXml(java.lang.String xmlrequest)
             throws java.lang.Exception
Send XML request to the server given as a String parameter
Parameters:
xmlrequest - request in XML, see DTDs.