Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.

Integrating a Database with DWR


Here, we integrate a database with DWR by exposing a database table via a remoted Java class. Our Java class connects directly to the database using JDBC, and related SQL statements are included in the class. Other ways to access databases include EJBs, Hibernate, and numerous others.

The example here replaces the first example in Chapter 4, Tables and Lists, so that country data comes from a database instead of a CSV file. From the application point of view there is only one change required in the dwr.xml file and that is changing the entry to point to the Java class that handles database access. Before we implement the Java class we have to set up and populate the database. Here we use Apache Derby database, which comes bundled with the Geronimo application server.

Configuring the Database in Geronimo

The first thing to do is to set up a database and table for our country data. This is easy when using Geronimo because it gives us the necessary tools for database...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
DWR Java AJAX Applications
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon