Azure SQL Database
An Azure relational database service.
6,326 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
While trying to connect to an Azure DB via java in Android Studio I got the following error message: java.sql.SQLException: Network error IOException: SSL handshake aborted: ssl=0x7455299a00: I/O error during system call, Broken pipe I use jtds-1.3.1.jar and my code for connection looks like this:
Thread thread = new Thread(() -> {
try {
// Load the jTDS driver
Class.forName("net.sourceforge.jtds.jdbc.Driver");
// Establish the database connection
String connectionUrl = "jdbc:jtds:sqlserver://bluetooth.database.windows.net:1433;DatabaseName=BluetoothDB;user=beheerder@bluetooth;password={password};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;ssl=require;";
Connection connection = DriverManager.getConnection(connectionUrl);
// Create an SQL query to insert data into the database
String sql = "INSERT INTO Results (Result, Date) VALUES (?, ?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, readValue);
statement.setString(2, dateNow);
// Execute the SQL query
statement.executeUpdate();
// Close the statement and connection
statement.close();
connection.close();
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
// Handle any exceptions that may occur during the database operation
}
});
First I got TLS version to low so I added "ssl=required"
Could you please try the multiple solutions provided on this StackOverflow forum thread?