Я хочу хранить электронные письма из Gmail в моей базе данных mysql. Я нашел Inboxreader с Google, но часть для подключения к mysql не работает. имя пользователя, имя базы данных, пароль правильный.
Кто-нибудь может мне помочь. Спасибо.
вот часть кода
{
Properties details= new Properties();
details.load(new FileInputStream("details.properties"));
String userName = details.getProperty("root");
String password = details.getProperty("password");
String url = details.getProperty("jdbc:mysql://localhost/test");
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
System.out.println ("Database connection established");
PreparedStatement st= conn.prepareStatement("insert into 'Email_list' values(?)");
for(String mail:mails)
{
try{
st.setString(1, mail);
st.execute();
}catch(Exception e){}
}
}
catch (Exception e)
{
System.err.println ("Cannot connect to database server");
e.printStackTrace();
}
finally
Вот код ошибки:
Cannot connect to database server
java.sql.SQLException: The url cannot be null
Reading:23
at java.sql.DriverManager.getConnection(DriverManager.java:554)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at inboxreader.InboxReader.connecttoMySql(InboxReader.java:181)
at inboxreader.InboxReader.Start(InboxReader.java:82)
at inboxreader.InboxReader.main(InboxReader.java:34)
Спасибо