java - Strange behavior trying to connect SQLite database -


After

Well I have some time trying to connect to DB like this:

  Public Static Connection Connect (string URL) {try {class.forName ("org.sqlite.JDBC"); } Grip (Klassnotfound Expression E) {e.printStackTrace (); } Hold (exception e) {e.printStackTrace (); } Connection = null; Try {conn = DriverManager.getConnection (url); // (1) // conn = DriverManager.getConnection ("jdbc: sqlite: settings.db"); // (2)} hold (SQLException east) {ex.printStackTrace (); } Return conn; }   

Then I call it from the main ...

  connect ("jbdc: sqlite: settings.db");   

It was only, I put in the work when I literally URL (2), but when I put variable (1)

Other information: < / p>

  • JDK (latest)
  • Netbeans 8
  • GNU / Linux - Arch64
  • encoding UTF-8 editor
  • JDBC driver -

    Any ideas? . Im stuck, thanks

    Edit:

    stacktrace

      java.sql.SQLException: Invalid database address: jbdc: SQLite: settings.db java on .sql.DriverManager.getConnection on org.sqlite.JDBC.createConnection (JDBC.java:74) org.sqlite.JDBC.connect (JDBC.java:64) (DriverManager.java:664) on java.sql. On DriverManager.getConnection (DriverManager.java:270) lyoneel.Sandbox.connect (Sandbox.java:59) on lyoneel.Sandbox.main (Sandbox.java:23)    

    There is some error in writing your code:

      connect (" jbdc: SQLite: settings.db ") ; ^^^^ - Should not be jdb j jbc    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -