[sqlite] Geting the errorcode in Java

2015-12-15 Thread Cecil Westerhof
2015-12-15 18:51 GMT+01:00 gwenn :

> Your code looks good to me.
> You should report an issue here: https://github.com/xerial/sqlite-jdbc
>

?Done.?


-- 
Cecil Westerhof


[sqlite] Geting the errorcode in Java

2015-12-15 Thread gwenn
Hello,
Your code looks good to me.
You should report an issue here: https://github.com/xerial/sqlite-jdbc
Regards.

On Mon, Dec 14, 2015 at 8:38 PM, Cecil Westerhof  
wrote:
> I have the following code:
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.Statement;
> import java.sql.SQLException;
>
>
> public class CheckProverbsLocked {
> private CheckProverbsLocked() {
> }
>
> public static void main(String [] args) throws Exception {
> Connection   conn;
> Statementstmt;
>
> Class.forName("org.sqlite.JDBC");
> conn = DriverManager.getConnection("jdbc:sqlite:proverbs.sqlite");
> stmt  = conn.createStatement();
> try {
> stmt.executeUpdate("begin immediate");
> } catch (SQLException e) {
> System.out.println(e.getErrorCode());
> System.out.println(e.getMessage());
> System.out.println(e.getSQLState());
> }
> stmt.close();
> conn.close();
> }
>
> }
>
>
> I get the following output when the database is locked:
> 0
> database is locked
> null
>
> I would expect the first one to be 5. What am I doing wrong?
>
> --
> Cecil Westerhof
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Geting the errorcode in Java

2015-12-14 Thread Cecil Westerhof
I have the following code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;


public class CheckProverbsLocked {
private CheckProverbsLocked() {
}

public static void main(String [] args) throws Exception {
Connection   conn;
Statementstmt;

Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:proverbs.sqlite");
stmt  = conn.createStatement();
try {
stmt.executeUpdate("begin immediate");
} catch (SQLException e) {
System.out.println(e.getErrorCode());
System.out.println(e.getMessage());
System.out.println(e.getSQLState());
}
stmt.close();
conn.close();
}

}


?I get the following output when the database is locked:
0
database is locked
null

?I would expect the first one to be 5?. What am I doing wrong?

-- 
Cecil Westerhof