...
Setting up a connection in JAVA
Before starting the client will require the following library: vjdbc-1.6.5.jar. This library can be found in the bin directory of the FEWS system.
No special jars other than the ones provided by the JRE are required.
Code Block |
---|
|
Code Block |
Class.forName("de.simplicit.vjdbc.VirtualDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:vjdbc:rmi://localhost:2000/VJdbc,FewsDataStore");
//example get Locations
Statement stmt = con.createStatement();
ResultSet set = stmt.executeQuery("SELECT * from Locations");
while (set.next()) {
System.out.print("Name:" + set.getString("name"));
System.out.print(", Id:" + set.getString("Id"));
System.out.print(", X:" + set.getString("x"));
System.out.print(", y:" + set.getString("y") + "\n");
}
|
...