[ jocat @ 07.06.2007. 12:15 ] @
Molim Vas da li je neko upeo od vas da poveze iReport i SQLite ?

Potrebno mi je to, posto pravim jednu standalone aplikaciju, a hteo bih da jedina instalacija na masini gde treba da radi softver bude instalirana java..

Hvala puno!
[ markoz @ 07.06.2007. 14:13 ] @
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();
        }
        
    }
    
}


[ jocat @ 08.06.2007. 11:03 ] @
Hvala!

Mada uspeo sam i ja pronaci ovaj code, i nije problem pristupiti bazi iz same Jave,.. Relativno je slicna veza kao i sa drugim bazama.

Problem je kako to sve povezati da radi sa iReport-om!

Probam sam i ovaj jar da prebacim u lib direktorijum iReporta ali ne radi.. Ne mogu da pronadjem u raspolozivim konekcijama i SQLite

Na google nikako nisam mogao da pronadjem bilo sta sto bi mi pomoglo!
[ jocat @ 13.07.2007. 19:18 ] @
Da li je neko uspeo da poveze iReport i SQLite ?

Ukoliko nije, da li bi mi neko mogao dati ideju sta bi to unutar iReporta mogao da iskoristim, a povezuje se na neku standalone bazu. To jest, ne moram da imam nikakvu instaliranu bazu na lokalnoj masini.

Mnogo sam vremena potrosio trazeci tako nesto, ali bez uspeha.