now result of SQL query is inside System.out.println(),
public class MyMain{
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://______8080/test-app","______","______");
PreparedStatement statement = con.prepareStatement("SELECT * FROM users");
ResultSet result = statement.executeQuery();
while(result.next()){
System.out.println(result.getString(1)+ " "+result.getString(2));
}
}
but how send result to client? Like image or smth. I should use "return"+"FileOutputStream"?But it safety if is large data?
i can parce SQL result on the server side, and then send it in bytearray,but how send it inside http