2009 Tutorial (DB4O and Visual Studio 2008 Express)



Similar documents
See the Developer s Getting Started Guide for an introduction to My Docs Online Secure File Delivery and how to use it programmatically.

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

Topic 11 Scanner object, conditional execution

CHAPTER 10: WEB SERVICES

Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion

MS Visual C++ Introduction. Quick Introduction. A1 Visual C++

Quartz.Net Scheduler in Depth

Sample CSE8A midterm Multiple Choice (circle one)

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

File class in Java. Scanner reminder. Files 10/19/2012. File Input and Output (Savitch, Chapter 10)

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

JDBC. It is connected by the Native Module of dependent form of h/w like.dll or.so. ex) OCI driver for local connection to Oracle

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

EJB 3.0 and IIOP.NET. Table of contents. Stefan Jäger / stefanjaeger@bluewin.ch

Building Java Programs

1001ICT Introduction To Programming Lecture Notes

How to Install Java onto your system

DEVELOPING CONTRACT - DRIVEN WEB SERVICES USING JDEVELOPER. The purpose of this tutorial is to develop a java web service using a top-down approach.

Overview of Web Services API

AP Computer Science File Input with Scanner

J a v a Quiz (Unit 3, Test 0 Practice)

Getting Started with Telerik Data Access. Contents

CompSci 125 Lecture 08. Chapter 5: Conditional Statements Chapter 4: return Statement

Using Visual C++ and Pelles C

Guidelines for Installing SQL Server and Client (SQL Server Management Studio)

Software Engineering 1 EEL5881 Spring Homework - 2

Implementing a WCF Service in the Real World

Building Java Programs

Using ilove SharePoint Web Services Workflow Action

Arrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays:

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

WEB SERVICES TECHNICAL GUIDE FOR DEVELOPERS

Introduction to Java

How To Develop A Mobile Application On Sybase Unwired Platform

Amazon Fulfillment Web Service. Getting Started Guide Version 1.1

Appendix M: Introduction to Microsoft Visual C Express Edition

CS170 Lab 11 Abstract Data Types & Objects

Chapter 9 Delegates and Events

IGEL Universal Management Suite migration

Getting Started with IVI Drivers

Collections.sort(population); // Método de ordenamiento

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

Log/Process/Hashing. Details. Activities. Processes

Manual For Using the NetBeans IDE

Java with Eclipse: Setup & Getting Started

Mitigation Planning Portal (MPP) Tutorial Canned Reports Updated 5/18/2015

Java Access to Oracle CRM On Demand. By: Joerg Wallmueller Melbourne, Australia

How to Move Mail From Your Old POP Account To Exchange Using Outlook 2010

How To Deploy Office 2016 With Office 2016 Deployment Tool

Amazon Glacier. Developer Guide API Version

Software Development with UML and Java 2 SDJ I2, Spring 2010

JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4

Installing Java. Table of contents

LAB4 Making Classes and Objects

A SharePoint Developer Introduction. Hands-On Lab. Lab Manual HOL8 Using Silverlight with the Client Object Model C#

Installing Java (Windows) and Writing your First Program

Introduction to Building Windows Store Apps with Windows Azure Mobile Services

Hello World RESTful web service tutorial

Visual Basic Programming. An Introduction

SharePoint Integration

Tutorial on OpenCV for Android Setup

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

How to use the Eclipse IDE for Java Application Development

Open Broadcasting Software (OBS) Guide for Krue.tv

Reading and Writing PCD Files The PCD File Format The Grabber Interface Writing a Custom Grabber PCL :: I/O. Suat Gedikli, Nico Blodow

MAIL MERGE TUTORIAL. (For Microsoft Word on PC)

AP Computer Science Java Subset

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

ASP.NET Dynamic Data

Generating Visual Studio Project Files

Start A New Project with Keil Microcontroller Development Kit Version 5 and Freescale FRDM-KL25Z

Developing a Three Tier Web Application Using ASP.NET and Open Source Object-Oriented Database DB4Objects

Introduction to Object-Oriented Programming

Building Java Programs

Microsoft Visual Studio 2010 Instructions For C Programs

The following program is aiming to extract from a simple text file an analysis of the content such as:

Web Services API Developer Guide

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

Word count example Abdalrahman Alsaedi

Yosemite National Park, California. CSE 114 Computer Science I Inheritance

Installing Globodox Web Client on Windows 7 (64 bit)

Getting Started Guide

Mapping Specification for DWG/DXF (MSD) C#.NET Code Samples

Chapter 2 Introduction to Java programming

Arrays in Java. Working with Arrays

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++)

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

AP Computer Science Static Methods, Strings, User Input

Microsoft Virtual Labs. Building Windows Presentation Foundation Applications - C# - Part 1

ECE 122. Engineering Problem Solving with Java

Setting up a database for multi-user access

Appium mobile test automation

Inheritance, overloading and overriding

Transcription:

Jákup Wenningstedt Hansen Side 1 12-10-2009 2009 Tutorial (DB4O and Visual Studio 2008 Express)...1 Download the Database...1 Installation of the Database...2 Creating the project in VS...3 Pointing VS to the DB4O...4 Creating the Database...5 Create two Objects and put them in the Database...6 The big code example...8 2009 Tutorial (DB4O and Visual Studio 2008 Express) The tutorial that comes along with DB4O, is not working that well so therefore I created this tutorial. Download the Database

Jákup Wenningstedt Hansen Side 2 12-10-2009 Installation of the Database Just follow the basic steps, and everything will be ok.

Jákup Wenningstedt Hansen Side 3 12-10-2009 Creating the project in VS Let start by creating a console project in Visual Studio(VS). The name is not important, but I named it DB4O_Connection.

Jákup Wenningstedt Hansen Side 4 12-10-2009 Pointing VS to the DB4O Then we come to the most important part. We shall point VS to the DB4O. This is done simply by right clicking on the project and then clicking Add Reference. And then find the Db4objects.Db4o.dll file from the net-3.5 folder, and double click. Now this project can use using Db4objects.Db4o.

Jákup Wenningstedt Hansen Side 5 12-10-2009 Creating the Database So let us create some code. It is important that you Save the project first. Than run it by taping Ctrl and F5. After this you should be able to find a file called DB4Ofile in the same folder that the project is stored. If not, there is something wrong. I shall assume that all went fine, and continue.

Jákup Wenningstedt Hansen Side 6 12-10-2009 Create two Objects and put them in the Database using System; using System.Collections.Generic; using System.IO; using System.Web; using Db4objects.Db4o.Query; using Db4objects.Db4o; namespace formul1 public class FirstStepsExample public static void Main(string[] args) IObjectContainer db = Db4oFactory.OpenFile("DB4Ofile"); try // storefirstpilot Pilot pilot1 = new Pilot("Michael Schumacher", 100); db.store(pilot1); // storesecondpilot Pilot pilot2 = new Pilot("Rubens Barrichello", 99); db.store(pilot2); Pilot proto = new Pilot(null, 0); IObjectSet result = db.querybyexample(proto); //ListResult(result); Console.WriteLine(result.Count); foreach (Pilot item in result) Console.WriteLine(item.getName()); finally db.close(); public class Pilot private String name; private int trips; public Pilot(String s, int i) name = s; trips = i; public String getname() return name;

Jákup Wenningstedt Hansen Side 7 12-10-2009 If you run this code it will produce this output. The first output is 2 object, and if you run it again it will show 4 objects in the database two Michael and 2 Rubens. So for every time you run it add 2 objects.

Jákup Wenningstedt Hansen Side 8 12-10-2009 The big code example using System; using System.Collections.Generic; using System.IO; using System.Web; using Db4objects.Db4o.Query; using Db4objects.Db4o; namespace formul1 public class FirstStepsExample public static void Main(string[] args) IObjectContainer db = Db4oFactory.OpenFile("filen3"); try //------run this only first time ---START----- Pilot pilot1 = new Pilot("Ann", 100); db.store(pilot1); Pilot pilot2 = new Pilot("Ben", 200); db.store(pilot2); Pilot pilot3 = new Pilot("Conny", 300); db.store(pilot3); Pilot pilot4 = new Pilot("Danny", 400); db.store(pilot4); //------run this only first time ---STOP----- Pilot proto = new Pilot(null, 0); IObjectSet result = db.querybyexample(proto); Team t = new Team("Hyundai"); Console.WriteLine(result.Count); foreach (Pilot item in result) //------run this only first time ---START----- if (item.getname().equals("conny")) item.setteam( t); db.store(item); //------run this only first time ---START----- Console.WriteLine(item.getName() + " : " + item.gettrips()); foreach (Pilot item in result) if (item.getname().equals("bo Bosen")) Console.WriteLine("Vi er inde i Bo Boesen: " + item.getname()); item.getteam().printteamname(); Console.WriteLine("Har lige printet Bo Boesens Team"); else Console.WriteLine("This Driver has got no Team: " + item.getname()); Team proto2 = new Team(null); IObjectSet result2 = db.querybyexample(proto2); foreach (Team item in result2) item.printteamname(); //---- Her har vi Native Quarie ----------------------- IList<Pilot> result3 = db.query<pilot>(delegate(pilot pilot) return pilot.trips > 300; //&& pilot.trips < 199 // pilot.name == "Rubens Barrichello"; ); foreach (Pilot item in result3) Console.WriteLine("Her har vi nativ quary"); item.printname(); //----------native slut -------------------------------- finally db.close();

Jákup Wenningstedt Hansen Side 9 12-10-2009 public class Pilot public String name; public int trips; private Team team; public Pilot(String s, int i) name = s; trips = i; public void setteam(team t) team = t; public Team getteam() return team; public String getname() return name; public int gettrips() return trips; public void printname() Console.WriteLine("Mit navn er: " + name); public class Team private String TeamName; public Team(String s) TeamName = s; public String getteamname() return TeamName; public void printteamname() Console.WriteLine("This is team: " + TeamName + " test"); After you run this example it shall produce this output I hope that this was a simple and quick tutorial to get started with DB4O from VS. Thanks. www.jakupwhansen.dk