SQLite issue

Discussion in 'Java' started by manguicho, Jun 5, 2014.

  1. manguicho

    manguicho Guest

    Mi problema es bien basico y me esta volviendo loco. Pido por favor a los expertos que me den un poco de luz al respecto.
    gracias!

    1)He bajado esto:
    https://bitbucket.org/xerial/sqlite-jdbc/downloads/sqlite-jdbc-3.7.2.jar

    2)generado SQLiteJDBC.java con el siguiente codigo:

    import java.sql.*;

    public class SQLiteJDBC
    {
    public static void main( String args[] )
    {
    Connection c = null;
    Statement stmt = null;
    try {
    Class.forName("org.sqlite.JDBC");
    c = DriverManager.getConnection("jdbc:sqlite:test.db");
    System.out.println("Opened database successfully");

    stmt = c.createStatement();
    String sql = "CREATE TABLE COMPANY " +
    "(ID INT PRIMARY KEY NOT NULL," +
    " NAME TEXT NOT NULL, " +
    " AGE INT NOT NULL, " +
    " ADDRESS CHAR(50), " +
    " SALARY REAL)";
    stmt.executeUpdate(sql);
    stmt.close();
    c.close();
    } catch ( Exception e ) {
    System.err.println( e.getClass().getName() + ": " + e.getMessage() );
    System.exit(0);
    }
    System.out.println("Table created successfully");
    }
    }
    3) Comiplado con :
    $ javac SQLiteJDBC.java
    4) al intentar ejecutar con:
    $ java -classpath ".;sqlite-jdbc-3.7.2.jar" SQLiteJDBC
    arroja el siguiente error:
    "Error: no se ha encontrado o cargado la clase principal SQLiteJDBC"

    desde ya muchas gracias!
     
    manguicho, Jun 5, 2014
    #1
    1. Advertisements

  2. manguicho

    Joerg Meier Guest

    On Thu, 5 Jun 2014 08:02:08 -0700 (PDT), wrote:

    Hallo,
    Leider kann ich mit Deinen Worten nichts anfangen. Ich spreche diese
    Sprache leider nicht.

    Liebe Gruesse,
    Joerg
     
    Joerg Meier, Jun 5, 2014
    #2
    1. Advertisements

  3. Try using a colon ":" rather than a semicolon ";" to separate the
    elements of the classpath.
     
    Steven Simpson, Jun 6, 2014
    #3
  4. manguicho

    Arne Vajhøj Guest

    If he is using *nix.

    Windows is using semocolon.

    The use of $ indicates that he is likely using *nix.

    I would also be tempted to drop the "" marks.

    Arne
     
    Arne Vajhøj, Jun 6, 2014
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.