Open Roads Consulting, Inc.

SoapDBC

Project page
Downloads
Mailing list

What is SoapDBC?

SoapDBC is an attempt to write a general purpose SOAP service to provide database access and queries similar to JDBC. Accessing remote databases using JDBC can be chalanging, especially if firewalls are involved. By using the standard SOAP protocol, remote databases are accessed via the http transport which is very firewall friendly.

How does it work?

The client sends a SQL command to the soap service, the service uses JDBC to execute the query against a local database. The service then returns the client an integer ID referencing the open query. The client then uses this ID to fetch records from the SOAP service. The records are send back as an XML message. Standard Java bindings are used to simplify access to the records and fields within the XML message.

Example client

The following is a simplified client program that uses the SoapDBC service.
BigInteger queryID = null;
String sql = "select * from data_base_table";
String defaultURL = "http://remotehost:8080/SoapDBC/services/SoapDBC";

try {
	// get remote service
	Options opts = new Options(new String[0]);
	opts.setDefaultURL(defaultURL);
	SoapDBCService sdbcLocator = new SoapDBCServiceLocator();
	SoapDBC sdbc = sdbcLocator.getSoapDBC(new URL(defaultURL));
	((SoapDBCBindingStub) sdbc).setMaintainSession (true);

	// open query dataset
	queryID = sdbc.executeQuery(sql);
		
	// get single record
	SdbcRecord rec = sdbc.getNext(queryID);
		
	// get batch records
	SdbcRecordSet recSet = sdbc.getBatch(queryID, BigInteger.valueOf(10));
		
	// close query dataset
	sdbc.close(queryID);
} catch (Exception e) {
	e.printStackTrace();
	System.exit(1);
}


Want more information?

Please feel free to e-mail me (David R Robison) with any questions regarding this tool! This project is sponsored by Open Roads Consulting, Inc.

SourceForge.net Logo