Curl Global Community

Full Version: CDBC Database Explorer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This sample applet can establish a connection with a CDBC server and lets you explore and even modify the databases and tables exposed by the connection. To use it, you must set up your own CDBC server, as explained in the online documentation (search for "database server" in the documentation index). The main purpose of this applet is to give a developer who wants to learn about CDBC some working code to play with.

The applet shows both the power and the limitations of the CDBC BasicConnection. We chose the name BasicConnection because this was released in the spirit of a beta: it is useful, but it has some limitations. We want to hear from developers that use it or even decide not to use it. We are currently working on more powerful middleware solutions under the umbrella of our CDK open source project.

One thing to note is that the security of the connection is established by the server. The CDBC servlet connects to the database server using one fixed set of credentials. Anyone with access to a BasicConnection has the access privileges granted by those credentials. Used in this way, CDBC is suitable for prototyping, experimental, or even small office uses, where access is limited to a small group of machines that are behind a firewall. An added level of security is available if the server is configured for HTTP basic authentication at the connection URL. A client will then have to provide a username and password in order to establish the connection. If you use https in combination with basic authentication then the connection should be secure.

This applet is pretty simple. First select a connection (the only choice is localhost, but you can easily modify the code add more if you set up more servers). When the connection is selected, the other controls are populated with the available databases and tables. When you change the selection, the selected table is shown below in a RecordGrid. If an error occurs, the stack trace is shown. Uncheck the Trap Errors checkbox if you'd rather the exception be thrown so you can debug it. A panel at the bottom shows the events that are fired at the underlying RecordSet.

Buttons are also provided to add a record or delete the current record. You can reload the data from the server, revert your changes, or commit them with the Save button.

Finally, there is an area where you can enter SQL statements. Press the Execute button if you don't expect any results when the statements are executed. Press the Query button if the statement is a query and you want the results to be shown in the RecordGrid.

db-explorer-sample.curl
Is the link for sample code broken?