SQLite error with Java

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

/**
 *
 * @author nathan
 */
public class Conexao {
    private Connection conexao;

    public boolean conection() {
        try{
            this.conexao = DriverManager.getConnection("jdbc:sqlite:\home\nathan\Downloads\PrograminhasSqlite\banco.db");
        }catch(SQLException e){
            System.err.println(e.getMessage());
            return false;
        }
        System.out.println("Conectou");
        return true;
    }
    public boolean desconection(){
           try{
                if(this.conexao.isClosed() == false){
                    this.conexao.close();
                }

        }catch(SQLException e){
            System.err.println(e.getMessage());
            return false;
        }
           System.out.println("Desconectou");
        return true;
    }
}

and is giving this error:

No suitable driver found for jdbc:sqlite:\home\nathan\Downloads\PrograminhasSqlite\banco.db
Exception in thread "main" java.lang.NullPointerException
    at Conexao.desconection(Conexao.java:31)
    at Main.main(Main.java:15)
/home/nathan/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1

When I click to see it says it is in if(this.conexao.isClosed()==false)

    
asked by anonymous 03.05.2018 / 02:35

0 answers