javadb/org/homelinux/largo/app/App.java
author Markus Bröker <mbroeker@largo.dyndns.tv>
Wed, 26 May 2010 14:56:44 +0200
changeset 126 52722ac7693f
parent 123 07b2c0b991af
child 135 f837cf975e95
permissions -rw-r--r--
mysql_db: get not more than num_fields fields from a row I haven't tested the old approach, because i have never installed or used mysql. But it's nice to see that it actually works with this small patch. committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
100
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
package org.homelinux.largo.app;
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
import org.homelinux.largo.sql.client.DBClient;
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
public class App {
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
	public static void main (String args[]) {
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
		try {
123
07b2c0b991af ClientDriver for remote access and EmbeddedDriver for local access
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 100
diff changeset
     8
			DBClient db = new DBClient ();
100
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
			db.query ("select * from euroleague order by team");
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
			while (db.hasNext ()) {
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
				System.out.println (db.getColumn (1));
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
			}
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
			db.close ();
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
		} catch (Exception e) {
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
			e.printStackTrace ();
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
		}
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
	}
a6d2add085d7 Apache Derby Examples...
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
}