@@ -0,0 +1,1448 @@
+package com.github.davidmoten.rx.jdbc;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.SQLException;%0A%0Aimport org.junit.Test;%0A%0Aimport com.github.davidmoten.rx.jdbc.annotations.Column;%0A%0Aimport rx.functions.Action1;%0A%0Apublic class DatabaseExampleTest %7B%0A%0A    @Test%0A    public void testCreateAndUseAnInMemoryDatabase() throws SQLException %7B%0A        // little trick for an in-memory h2 database so that closing a%0A        // connection to it doesn't throw the db away%0A        Connection con = Database.from(%22jdbc:h2:mem:demo1%22).getConnectionProvider().get();%0A        Database db = Database.from(con);%0A        db.update(%0A                %22create table person (name varchar(50) primary key, score int not null,dob date, registered timestamp)%22)%0A                .count().toBlocking().single();%0A%0A        db.update(%22insert into person(name,score) values(?,?)%22).parameters(%22FRED%22, 21).count()%0A                .toBlocking().single();%0A%0A        // use java 8 lambdas if you have them !%0A        db.select(%22select name, score from person%22).autoMap(Person.class)%0A                .forEach(new Action1%3CPerson%3E() %7B%0A                    @Override%0A                    public void call(Person person) %7B%0A                        System.out.println(person.name() + %22 has score %22 + person.score());%0A                    %7D%0A                %7D);%0A        db.close();%0A    %7D%0A%0A    static interface Person %7B%0A        @Column%0A        String name();%0A%0A        @Column%0A        int score();%0A    %7D%0A%0A%7D%0A

add simple demo