Информация об изменениях

Сообщение Ошибка при соединении с БД от 06.10.2025 13:53

Изменено 06.10.2025 13:53 Funny Rabbit

Ошибка при соединении с БД
Вот такой код
String url = "jdbc:postgresql://localhost:5433/libra";
                String user = "light";
                String password = "P0!yak0v5V";
                try {
                    Connection connection = DriverManager.getConnection(url, user, password);

                    String query = "select value from light.t_weight_metrics";
                    Statement stmt = connection.createStatement();
                    ResultSet rs = stmt.executeQuery(query);
                    while(rs.next())
                    {
                        spinnerAdapter.add(rs.getString(0));
                    }
                    connection.close();
                } catch (SQLException e) {

                    TextView t = (TextView)findViewById(R.id.etmErrors);
                    t.setText(e.toString());
                }

приводит к такой ошибке

org.postgresql.util.PSQLException: Something unusual has occurred to cause the driver to fail. Please report this exception.



В чем может быть дело? В сети ответа не нашел.
Ошибка при соединении с БД
Вот такой код
String url = "jdbc:postgresql://localhost:5433/libra";
                String user = "пользователь";
                String password = "пароль";
                try {
                    Connection connection = DriverManager.getConnection(url, user, password);

                    String query = "select value from light.t_weight_metrics";
                    Statement stmt = connection.createStatement();
                    ResultSet rs = stmt.executeQuery(query);
                    while(rs.next())
                    {
                        spinnerAdapter.add(rs.getString(0));
                    }
                    connection.close();
                } catch (SQLException e) {

                    TextView t = (TextView)findViewById(R.id.etmErrors);
                    t.setText(e.toString());
                }

приводит к такой ошибке

org.postgresql.util.PSQLException: Something unusual has occurred to cause the driver to fail. Please report this exception.



В чем может быть дело? В сети ответа не нашел.