Thread Rating:
  • 755 Vote(s) - 2.71 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CDBC Database Explorer
07-01-2011, 10:04 AM, (This post was last modified: 07-01-2011, 11:35 AM by ashimo.)
CDBC Database Explorer
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.

12-12-2013, 10:33 PM,
RE: CDBC Database Explorer
Is the link for sample code broken?

Forum Jump:

Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
INSERT INTO mybb_threadviews (tid) VALUES('94')