Created
July 15, 2021 06:36
-
-
Save muhomerdogu/a1a333ac8d659442d6cbc5756ca55432 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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