This question already has an answer here:
- How to connect SQLite with Java? 8 answers
I use jdbc driver connect to sqlite database which is produced by sqlite manager. I use the following one, it works well,
Connection conn =DriverManager.getConnection("jdbc:sqlite:C://Users//13149//Desktop//SqliteDB0.sqlite");
When I replace the above one by the following one,
Connection conn =DriverManager.getConnection("jdbc:sqlite:localhost:3306//Database//SqliteDB0.sqlite"); (*)
the first run, it stops there, nothing happen. But when I again, it always gives following error messages:
java.sql.SQLException: path to 'localhost:3306//Database//SqliteDB0.sqlite': 'C:\Users\13149\Documents\NetBeansProjects\SqliteOpenDB\localhost:3306' does not exist
at org.sqlite.core.CoreConnection.open(CoreConnection.java:192)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:24)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at org.sqlite.JDBC.connect(JDBC.java:88)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at sqliteopendb.SqliteOpenDB.main(SqliteOpenDB.java:30)
Here SqliteOpenDB.java:30 is (*) sentence. Anyone can help me? Thanks.
Aucun commentaire:
Enregistrer un commentaire