Please tell me why it is
public class Main { private static final String URL = "jdbc:mysql://localhost:3306/test"; private static final String USERNAME = "root"; private static final String PASSWORD = "root"; public static void main(String[] args) { try { Driver driver = new FabricMySQLDriver(); DriverManager.registerDriver(driver); Connection connection = getConnection(URL, USERNAME, PASSWORD); } catch (SQLException e) { System.err.println("Не удалось загрузить класс драйвера!"); } public static void sel (Connection connection) { try (Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery("{CALL sel}"); while (resultSet.next()) { System.out.println(resultSet.getInt(1) + " " + resultSet.getString(2)); } } catch (SQLException e) { e.printStackTrace(); } } public static void ins_upd (Connection connection, int ID, String NAME) { try { PreparedStatement pstmp = connection.prepareStatement("{CALL ins_upd(?,?)}"); pstmp.setInt(1, ID); pstmp.setString(2, NAME); System.out.println("Готово!"); } catch (SQLException e) { e.printStackTrace(); } } public static void del (Connection connection, int ID) { try { PreparedStatement pstmp = connection.prepareStatement("{CALL del(?)}"); pstmp.setInt(1, ID); System.out.println("Готово!"); } catch (SQLException e) { e.printStackTrace(); } } } gives errors:
Error26, 9) java: illegal start of expression Error26, 16) java: illegal start of expression Error26, 22) java: ';' expected Error26, 28) java: not a statement Error26, 31) java: ';' expected It was conceived as methods for the three stored procedures for the web server, but I get them not designed so?
public static void main(String[] args)method endpublic static void main(String[] args)? Thepublic static void sel (Connection connection)method declaration is part of a class or part of amain? - m. vokhm