Name: sample.servlet.jdbc
Owner: WASdev
Description: Basic servlet sample with a simple JDBC datasource definition. #JavaEE7
Created: 2017-02-03 15:11:51.0
Updated: 2017-02-03 15:19:01.0
Pushed: 2017-10-24 21:16:57.0
Homepage: null
Size: 72
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The ServletJDBCEngine sample contains a server definition for basic servlet support, and illustrates a simple datasource definition using an included configuration file. It uses Apache Derby (an open source relational database). Also included is a servlet which gets a connection to the database using the defined datasource, creates a table, inserts some data, retrieves the data, and prints the data out to the browser.
Once the server is running, the application will be available under http://localhost:9080/JDBCApp.
CWWKZ0001I: Application JDBCApp started in XX.XX seconds.
In your browser, enter the URL for the application: http://localhost:9080/JDBCApp.
In your browser, you should see the message:
Text retrieved from database is: myHomeCounty
This project can be built with Apache Maven. The project uses the Liberty Maven Plug-in to automatically download and install the Liberty Java EE Web Profile 7 from Maven Central. The Liberty Maven Plug-in is also used to create, configure, and run the application on the Liberty server.
Use the following steps to run the application with Maven:
Execute full Maven build. The Liberty Maven Plug-in will download and install the Liberty server.
n clean install
To run the server with the Servlet sample execute:
n liberty:run-server
This project can also be built and run using Gradle. The provided build.gradle
file applies the Liberty Gradle Plug-in and is configured to automatically download and install the Liberty Java EE Web Profile 7 runtime from Maven Central. The Liberty Gradle Plug-in also has tasks that create, configure, and run applications on a Liberty server.
Use the following steps to run the application with the Gradle wrapper. (Windows machines use gradlew.bat
):
Execute the full Gradle build. The Liberty Gradle Plug-in will download and install the Liberty server.
gradlew clean build
To start the server with the JDBCApp sample run:
gradlew libertyStart
Alternatively, execute the run command:
gradlew libertyRun --no-daemon
To stop the server, execute:
gradlew libertyStop
Please refer to the Liberty Gradle Plug-in repository for documentation and configuration examples for the plug-in.
© Copyright IBM Corporation 2017.
nsed under the Apache License, Version 2.0 (the "License");
may not use this file except in compliance with the License.
may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS,
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
the License for the specific language governing permissions and
tations under the License.