Nisam radio sa iReportom (sad cu da ga googlam) ali sam radio dosta sa Sqlite-om i sqlitejdbc-v033-nested.jar
U dodatku imas primer src-a jave a sqlitejdbc-v033-nested.jar imas na netu svuda tako da...
Pozdrav
Code:
import java.sql.*;
/**
* Very Basic SQLite Database Example
* @author Brandon Tanner
*/
public class SQLiteTest {
public static void main(String[] args) {
try {
// The SQLite (3.3.8) Database File
// This database has one table (ASdata) with 6 columns (asn,lat,long,name,city,iso)
// It has like 25000 records
String fileName = "/home/mare/testsql/ASLatLong.sq3";
// Driver to Use
// http://www.zentus.com/sqlitejdbc/index.html
Class.forName("org.sqlite.JDBC");
// Create Connection Object to SQLite Database
// If you want to only create a database in memory, exclude the +fileName
Connection conn = DriverManager.getConnection("jdbc:sqlite:"+fileName);
// Create a Statement object for the database connection, dunno what this stuff does though.
Statement stmt = conn.createStatement();
// Create a result set object for the statement
ResultSet rs = stmt.executeQuery("SELECT * FROM ASdata where city ='FRANKFURT';");
// Iterate the result set, printing each column
// if the column was an int, we could do rs.getInt(column name here) as well, etc.
while (rs.next()) {
String asn = rs.getString("asn"); // Column 1
String latitude = rs.getString("latitude"); // Column 2
String longitude = rs.getString("longitude"); // Column 3
String name = rs.getString("name"); // Column 4
String city = rs.getString("city"); // Column 5
String iso_country = rs.getString("iso_country"); // Column 6
System.out.println("ASN: "+asn+" Latitude: "+latitude+" Longitude: "+longitude+" Name"+name+" City:"+city+" Country ISO:"+iso_country);
}
// Close the connection
conn.close();
}
catch (Exception e) {
// Print some generic debug info
System.out.println(e.getMessage());
System.out.println(e.toString());
e.printStackTrace();
}
}
}