これらのパラメーターを使用して、PHPMyAdmin をリモート MySQL サーバーに接続しています。
$cfg['blowfish_secret'] = 'ba17c1ec07d65003';
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '*remoteServer*:3306';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['controluser'] = '*user*';
$cfg['Servers'][$i]['controlpass'] = '*password*';
JavaでこのMySQLサーバーに接続しようとしていますが、どちらも機能しません:
final String url ="jdbc:mysql://*remoteServer*:3306/*user*";
Connection conn = DriverManager.getConnection(url, "*user*", "*password*");
そして、「:3306」が削除された場合:
final String url ="jdbc:mysql://*remoteServer*/*user*";
Connection conn = DriverManager.getConnection(url, "*user*", "*password*");
次のエラーが表示されます。
SQLException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
SQLState: 08S01
VendorError: 0
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
これは、「blowfish_secret」(単なるランダム Cookie) と「auth_type」="cookie" が Java で考慮されていないことが原因だと思います。
これを修正するにはどうすればよいですか?
また、MySQL に、jdbc ドライバーとの対話を受け入れる必要があることを伝える必要がありますか? (はいの場合、私は失敗しています。MySQL 構成ファイルにアクセスできません)