Click here to Skip to main content
15,502,574 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want store into database but it thrown this error "
[SQLITE_ERROR] SQL error or missing database (no such table: githublists)

I already create this database and I check spelling is correct but still thrown this error.

What should I do to solve this ?

What I have tried:

package com;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class git {
   public static void main (String args[]) {
       final String url = "";

       try {
           final Document document = Jsoup.connect(url).get();
           for (Element row :"div.edit-comment-hide tr").subList(1, 29)) {
               if ("[href]").text().equals("")) {
               } else {
                   final String githubID ="[href]").text();
                   final String matricNo ="p").text();
                   final String repository2 = matricNo.replace("Matic", "Matric");
                   final String matric = repository2.replace(" ", "");

                   git t = new git();
                   t.add(matric, githubID);
       } catch (IOException e) {
       private Connection connect() {
           // SQLite connection string
           String url = "jdbc:sqlite:C://sqlite/db/test.db";
           Connection conn = null;
           try {
               conn = DriverManager.getConnection(url);
           } catch (SQLException e) {
           return conn;
       public void add (String matric,String githubID ) {
           String sql = "INSERT INTO githublists(matric_no,githublinks) VALUES(?,?)";

           try (Connection conn = this.connect();
                PreparedStatement pstmt = conn.prepareStatement(sql)) {
               pstmt.setString(1, matric);
               pstmt.setString(2, githubID);
           } catch (SQLException e) {

Updated 18-Apr-21 21:40pm
Richard MacCutchan 19-Apr-21 3:28am    
I have just created a database with the correct table and column names and run your code, and it works fine. Your issue must be connected to the file you are using.

1 solution

The error message is pretty much self explanatory:
[SQLITE_ERROR] SQL error or missing database (no such table: githublists)
It's telling you as clearly as it can that you have asked it to INSERT data into a table called "githublists" and that table does not exist in that file.
Check your SqLite database file - make sure it's the one listed in the connection string - and pay attention to the table names: did you call it "githublist" or "githublists" for example.

And don't "hard code" connection strings into you app - always use a config file as otherwise you have to release untested software once you change the location for release versions.
Share this answer
Cow cow Lee 19-Apr-21 2:57am    
I have check this sqlite database file and the name is the same exactly I call.So I do know went wrong.
OriginalGriff 19-Apr-21 3:27am    
Which db file did you access, and how did you access it? When did you access it? From which computer?

Remember, I have no access to your file system!
Cow cow Lee 19-Apr-21 8:02am    
Thank advice, using same computer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900