dateformating in youtubeapi; usessl for mysql

This commit is contained in:
mrbesen 2021-10-18 15:18:37 +02:00
parent 4572e67e76
commit 25c82acfd9
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
2 changed files with 3 additions and 4 deletions

View File

@ -98,10 +98,9 @@ public class DB implements Runnable {
private void connect(boolean selectdb) {
try {
Class.forName("com.mysql.jdbc.Driver");//Treiber laden try this driver: com.mysql.cj.jdbc.Driver
//verbinden
con = DriverManager.getConnection("jdbc:mysql://" + server + ":" + port + "/" + (selectdb ? db : "") + "?serverTimezone=UTC" ,user,pw);
}catch (ClassNotFoundException | SQLException e) {
con = DriverManager.getConnection("jdbc:mysql://" + server + ":" + port + "/" + (selectdb ? db : "") + "?serverTimezone=UTC&verifyServerCertificate=false&useSSL=true", user, pw);
}catch (SQLException e) {
log.error("Error while connecting to the database! ", e);
}
}

View File

@ -114,7 +114,7 @@ public class YoutubeAPI {
} else if(split[0].equals("publishedAt")) {
String tmp = removeunwanted(split[1]);
tmp = tmp.replace('T', ' ');
tmp = tmp.substring(0, tmp.length()-5);
tmp = tmp.substring(0, 19);
Date d = dateformat.parse(tmp);
v.created = d.getTime() / 1000;
}else if(split[0].equals("nextPageToken")) {