I am a beginner, learning Java and now I don't know how to solve this problem in my JDBC program.
Code:
sqliteConnection.java
import java.sql.*;
import javax.swing.*;
public class sqliteConnection {
Connection conn = null;
public static Connection dbConnector()
{
try
{
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\danil\\Desktop\\Student.sqlite");
JOptionPane.showMessageDialog(null, "Successfully connected to Database");
return conn;
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
return null;
}
}
}
Login.java
import java.awt.EventQueue;
import java.sql.*;
import javax.swing.*;
import javax.swing.JFrame;
public class Login {
private JFrame frame;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login window = new Login();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Connection connection = null;
public Login() {
initialize();
connection = sqliteConnection.dbConnector();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Console
Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module sqlite.jdbc contains package org.sqlite.date, module org.xerial.sqlitejdbc exports package org.sqlite.date to sqlite.jdbc
What I have tried:
I tried everything, tried solving by myself(but I can't realy I am beginner) ,asked questions on groups (every group deleted post :( )