--- Marc Siegel <[EMAIL PROTECTED]> wrote:
> I don't think that the usage example for SQLiteJDBC (at
> http://www.zentus.com/sqlitejdbc/) is correct.
> 
> Specifically, the insert syntax should be changed from:
>   stat.executeUpdate("create table people (name, occupation);");
> To:
>   stat.executeUpdate("create table people values(name, occupation);");
> 
> The current syntax fails for me in the sqlite3 commandline client as
> well (3.1.3 on OS X). The proposed syntax works, and fits what is
> described in the SQLite docs:
>   http://www.sqlite.org/lang_insert.html
> 
> Thanks,
> -Marc

I think you copied and pasted the create line instead of the insert line.
The CREATE statement is correct in the example.

But yes, the JDBC example on the home page appears to have a few errors.
Here's a corrected version:

import java.sql.*;
public class Test {
  public static void main(String[] args) {
    try {
      Class.forName("org.sqlite.JDBC");
      Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
      Statement stat = conn.createStatement();
      stat.executeUpdate("create table people (name, occupation);");
      stat.executeUpdate("insert into people values ('Gandhi', 'politics');");
      stat.executeUpdate("insert into people values ('Turing', 'computers');");
      stat.executeUpdate("insert into people values ('Wittgenstein', 
'smartypants');");
      ResultSet rs = stat.executeQuery("select * from people;");
      while (rs.next()) {
        System.out.println("name = " + rs.getString("name"));
        System.out.println("occupation = " + rs.getString("occupation"));
      }
      rs.close();
      conn.close();
    } catch (Exception e) { System.err.println(e); }
  }
}


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to