Intelij Windows 10 SQLITE Access denied

Multi tool use
Multi tool use


Intelij Windows 10 SQLITE Access denied



This is a Java Project which connect to a sqlite database. I didn't really know where is the problem, I am making a login app to my manager here is my code :


package dbUtil;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class dbConnection {
public static final String USERNAME = "dbuser";
public static final String PASSWORD = "dbpassword";
public static final String CONN = "jdbc:mysql:\localhost/login";
public static final String SQCONN = "jdbc:sqlite:\dbname.sqlite";

public static Connection getConnection() throws SQLException{
try{
Class.forName("org.sqlite.JDBC");
return DriverManager.getConnection(SQCONN);
}catch (ClassNotFoundException e){
e.printStackTrace();
}
return null;
}
}



And here is the error i found, i didn't know what exactly is happening:


java.sql.SQLException: opening db: 'dbname.sqlite': Access is denied
at org.sqlite.core.CoreConnection.open(CoreConnection.java:203)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:25)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
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 dbUtil.dbConnection.getConnection(dbConnection.java:20)
at LoginApp.LoginModel.<init>(LoginModel.java:18)
at LoginApp.LoginController.<init>(LoginController.java:19)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at LoginApp.LoginApp.start(LoginApp.java:15)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)



PS: i found someone's comment but i didn't get what he meant exactly :
I had created a SQLite database prior to watching this video and I saved it in a different directory. For my project, I didn't create a fresh .sqlite like Awais did in the video. I was exporting my original database to a new .sqlite file using SQLite Studio. This was the problem of why I couldn't log in (1:20:00) to the database. SQLite Studio apparently encrypts the database if you export it into a new database; so that means that your program can't access its contents. What i did, was copy my original database that I created, and moved it into the project/src directory. This was my hang up. Awais isn't very clear on how he copied his database to the project directory at the beginning of the video, so I kinda glazed over this step and didn't do it with my database. DO NOT SKIP THIS STEP. Good luck guys.





Possible duplicate of java.sql.SQLException: Opening db:'DB-NAME.sqlite' : Permission denied
– Andreas
Jul 2 at 0:02





Possible duplicate of java.sql.SQLException: Opening db:'DB-NAME.sqlite' : Permission denied
– craigcaulfield
Jul 2 at 0:14





I already changed 'dbname.sqlite' by 'dbname.db' but i found the same result.
– Musta ZIR
Jul 2 at 0:52





@MustaZIR have a look at the directory/folder/file permissions?
– Rick
Jul 2 at 1:19





@Rick the SYSTEM has the full control of the file, so this didn't solve my problem yet.
– Musta ZIR
Jul 2 at 10:53









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

jbhnlPZDi02MTPS 1waZW kT4,ZCJL6g4B3sn S,iuZlpHOu,Mq,T,M df8,Sxrj8qnrPrAHl9dP512XZLx6JRZD0E1LV
LsIINeTIJ,CGG

Popular posts from this blog

Rothschild family

Cinema of Italy