This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
There is an .asp hybrid shortcut we have used on projects here where I work to pass data requests to a database and return disconnected recordsets. Using java.net we open an .asp page as a document, passing stored procedure name and parameters as the querystring portion of the url (in a couple of cases we have passed simple sql), using ADO in the .asp to execute the query, and response.write'ing the result in a deliminited fashion easily parsible by the calling java class. Its quick and easy for executing updates and returning disconnected recordsets, but won't, of course give you a static connection to the database.
Joined: Jan 07, 1999
There are many other ways of connecting to databases, but they all need extra work, and all are specific to particular databases or database interfaces. For example, you could implement Oracle's SQL.NET protocol yourself, rather thna using Oracle's thin drivers, or write code to parse the data structures in an Access MDB file. You would need to deal with threading issues and data integrity yourself, but it could theoretically be done. When JDBC is so easily available, powerful, and implemented for such a wide range of databases there seems little reason other than personal interest to do any of this, though. If you are interested in this sort of thing, there is a book "Java Database Programming" by Brian Jepson, published by Wiley, which describes in detail the implementation of an SQL database which uses plain text files for data storage, and includes all the source code.
However there are some draw backs to JDBC. Some might be speed. When you are connecting to a database the first thing to do is find out how many hit the page will have and about how many queries will be expected. Sometimes java is better to use on a site that gets more hits then another. Sometimes you can use other languages that will be faster. It is all relative to the site. Many times I use PHP to interface with an Oracle database or Postgres database. On the sites that use PHP, jdbc was slower. RMI would be another option to look into. Hope that answers some questions.