Skip to content

Instantly share code, notes, and snippets.

@muhomerdogu
Created July 15, 2021 06:36
Show Gist options
  • Save muhomerdogu/a1a333ac8d659442d6cbc5756ca55432 to your computer and use it in GitHub Desktop.
Save muhomerdogu/a1a333ac8d659442d6cbc5756ca55432 to your computer and use it in GitHub Desktop.
package Test_1;
import Test_4.Test_4;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
public class Test_1 {
public static void main(String[] args) {
Connection connection=null;
Test_3 helper=new Test_3();
Statement statement=null;
ResultSet resultSet=null;
try{
connection=helper.getConnection();
statement=connection.createStatement();
resultSet=statement.executeQuery("Select Code, Name, Continent, Region from country");
ArrayList<Test_4> countries=new ArrayList<Test_4>();
while(resultSet.next())
{
countries.add(new Test_4(resultSet.getString("Code"),resultSet.getString("Region"),
resultSet.getString("Name"),resultSet.getString("Contient")));
}
} catch (SQLException exception) {
exception.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment