SQLite issue

M

manguicho

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!
 
J

Joerg Meier

On Thu, 5 Jun 2014 08:02:08 -0700 (PDT), (e-mail address removed) wrote:

Hallo,
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!

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

Liebe Gruesse,
Joerg
 
S

Steven Simpson

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"

Try using a colon ":" rather than a semicolon ";" to separate the
elements of the classpath.
 
A

Arne Vajhøj

Try using a colon ":" rather than a semicolon ";" to separate the
elements of the classpath.

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top