|
Re: JDBC [message #1792115 is a reply to message #1792111] |
Wed, 11 July 2018 19:32 |
Patrick Moran Messages: 141 Registered: March 2018 |
Senior Member |
|
|
I suggest that you start with something much simpler, get it to work, and then gradually introduce the picky kinds of things that your connection seems to require for whatever your programming purposes are.
Here is what I used when I was trying to make sure what was holding back a connection to a sqlite database. Maybe you can do something similar to start with:
import java.sql.*;
import javax.swing.*;
import java.sql.Connection;
public class sqliteConnection {
public static Connection dbConnector(){
Connection conn = null;
JOptionPane.showMessageDialog (null, "Ready for the try block after declaring conn.");
try {
JOptionPane.showMessageDialog (null, "Just inside the try-catch block.");
Class.forName("org.sqlite.JDBC");
JOptionPane.showMessageDialog (null, "Did the Class.forName stuff. Ready for conn- ...");
conn = DriverManager.getConnection("jdbc:sqlite:/Users/JohnPaulJones/EmployeeData.sqlite"); //Can't be Connection conn
JOptionPane.showMessageDialog(null, "Connection Successful.");
return conn;
}catch (Exception e)
{
JOptionPane.showMessageDialog(null,"sqliteconnection fails with exception: " + e);
return null;
}
}
}
I'm on a Mac, so the path is easier to write. For Windows I think you have to use backslashes and you have to escape them so they will function as real backslashes, i.e., instead of Mac's / you have to write \\ to get the path to work right.
Also, I would google for "CLIENT_PLUGIN_AUTH" to find out what this is and where your program should be able to find it.
[Updated on: Wed, 11 July 2018 19:37] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05296 seconds