Difference between revisions of "Database Tutorial"

From RifidiWiki

Jump to: navigation, search
(Prerequisites)
(Outline)
Line 49: Line 49:
 
=Download the Source=  
 
=Download the Source=  
 
=Outline=
 
=Outline=
 +
* [[Database Tutorial Create Application| Step 1: Create the Application]]
 +
* [[Database Tutorial Implement DAO| Step 2: Implementing the DAO]]
 +
* [[Database Tutorial Command Provider| Step 3: Create a Command Provider]]

Revision as of 23:37, 30 November 2009

This document provides instructions for creating an edge server application that logs RFID tags to a database.

Download and Run the Application

This section provides instructions on how to download the final application and run it. It assumes you already have downloaded and installed the edge server and that you know how to read tags. If you need help with this see Edge Server Getting Started

MySQL Configuration

If you are using MySQL

  • First set up a MySQL instance and create a database called rifididb. There are no instructions here on how to set up MySQL on your system. There are plenty of tutorials on that, however.
  • Now open up 'edge server.ini' in the edge server file and add this:
-Dorg.rifidi.jdbc.driver=com.mysql.jdbc.Driver
-Dorg.rifidi.jdbc.url=jdbc:mysql://127.0.0.1/rifididb
-Dorg.rifidi.jdbc.user=root
-Dorg.rifidi.jdbc.pass=root

Derby Configuration

If you are using Derby

  • You don't need to configure a derby DB in the same way you have to configure a MySQL DB, since it is embedded.
  • Open up 'edge server.ini' in the edge server file and add this:
-Dorg.rifidi.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
-Dorg.rifidi.jdbc.url=jdbc:derby:RifidiDB;create=true
-Dorg.rifidi.jdbc.user
-Dorg.rifidi.jdbc.pass

Run the App

Note that you need to set the url, user, and pass to the values according to your database.

  • Start up the edge server, workbench, and start reading tags just like you are used to doing.
  • Now type this into the edge server console (at the osgi prompt)
loadApp dbapp

That is what loads the application.

  • Wait for it to tell you the bundles are loaded properly. Then type this:
dbstart

Prerequisites

This tutorial assumes that you are using eclipse, that you have some java development experience, and that you know how to run the edge server and get tags back from it. The Northwind Tutorial is much more in-depth than this one, and is recommended for people who have little experience with java and/or eclipse.

To get started

Download the Source

Outline

Personal tools