1

I have Linaro 12.07 (Ubuntu 3) I`ve made

sudo apt-get install sqlite3 libsqlite3-dev  libxml2-dev g++ ncurses-dev

and Linaro says:

libncurses5-dev is already the newest version. 
libxml2-dev is already the newest version.
libsqlite3-dev is already the newest version.
sqlite3 is already the newest version.

How should i connect from Java project ? I assume there must be some jar-file or something like this?

I had another sqlite library in JAR and i`ve started my program like this: java .:MySqliteJar.jar MyJavaApp

But since i`ve installed new version i dont know where should i find it.

closed as unclear what you're asking by Anthon, Braiam, jasonwryan, Gilles, Renan Apr 24 '14 at 23:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please, could you clarify what are your objectives and goals and what you have try so far to connect to your DB ? It's not very clear in fact. Also Ubuntu 3 ? – Kiwy Apr 24 '14 at 17:25
1

How should i connect from Java project ? I assume there must be some jar-file or something like this?

Possibly -- this depends on whether your installation has a driver available. The Java API has a generalized interface for SQL. To test if you have an sqlite driver:

import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Test {
    public static void main (String[] args) {
        Driver sqlite = null;
        try {
            sqlite = DriverManager.getDriver("jdbc:sqlite:test.sqlite");
        } catch (SQLException ex) {
            System.out.println(ex);
            System.exit(1);
        }

        System.out.format (
            "version %d.%d\n",
            sqlite.getMajorVersion(),
            sqlite.getMinorVersion()
        );
    }
}     

If you get java.sql.SQLException: No suitable driver then you need one. First check with your package manager:

apt-cache search sqlite | grep java

Will work on Ubuntu (there should be one). If you don't find anything, or you are using Oracle (in which case you might be able to pull the ice tea one out and use it), there's a (evidently unmaintained) list here; I don't have anything in particular to recommend from that although this one worked with the above test. Put the .jar in the current directory, compile, and:

java -classpath ".:sqlite-jdbc.jar" Test  

Not the answer you're looking for? Browse other questions tagged or ask your own question.