JavaアプリケーションでAzureホストのSQLデータベースにアクセスしようとしています。私はnmapのを使用してポート1433をチェックし、それは、それが閉じていていることを示していますMacのAzure SQLデータベースでポート1433を開くことができません
Starting Nmap 7.12 (https://nmap.org) at 2016-09-02 09:44 PHT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00014s latency).
Other addresses for localhost (not scanned): ::1
PORT STATE SERVICE
1433/tcp closed ms-sql-s
私は/etc/pf.confを編集していると私のMacを再起動しますがポートがまだ閉じられています。以下は私のpf.confです:
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
pass in proto tcp from any to any port 1433
また、私のファイアウォールはオフに設定されています。
私のjavaアプリはこのエラーを投げている:
Error starting database: The TCP/IP connection to the host flowengine7.database.windows.net, port 1433 has failed. Error: "Connection timed out: no further information. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
Javaコード:
String connectionString =
"jdbc:sqlserver://dbName.database.windows.net:1433;database=dbName;[email protected]@user;password=passwordhere;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;";
Connection connection = null;
try {
connection = DriverManager.getConnection(connectionString);
println 'connected';
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (connection != null) try {
connection.close();
} catch (Exception e) {
}
}
質問を編集して、SQLデータベースサービスとの接続に使用している実際のJavaコードを表示することをお勧めします。また、あなたのIPアドレスをSQLデータベースサーバのIPリストに追加しましたか? –
私のJavaコードを追加しました。私は既にホワイトリストに自分のipを追加しました。 – danieljohngomez