I am trying to connect to a database on my raspbery pi
. I have mysql
downloaded on the pi and have created a database on there already. I am trying to use driver manager to connect.
Here is my code for it:
public static void main(String[] args) {
try {
String host = "jdbc:mysql://scheduleit.duckdns.org:99/scheduleit";
String uName = username;
String uPass = password;
Connection con = DriverManager.getConnection(host, uName, uPass);
} catch (SQLException e) {
e.printStackTrace();
}
}
I have gone into the configuration files and changed the max_allowed_packet
to 32M
for [mysqldump
]. I looked through the other configuration files and was unable to find another max_allowed_packet field to edit. Additionally, I have used the command: SET GLOBAL max_allowed_packet=32M;
in mysql
.
One thing I was curious about was whether the hostname was wrong. I ssh into the pi using port 99, but perhaps I use a different port when connecting with a DriverManager
? The default port for mysql
is 3306 and I tried that, but wasn't getting a connection.
Finally, I am using mariadb
, which to my understanding is essentially mysql, since I log into using the mysql -u root -p
command. Any help would be much appreciated.