commit cbf60e8c9929bea8be8647c04952bd82407858d7 Author: Jonas Hinterdorfer Date: Thu Mar 27 11:18:19 2025 +0100 added main diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a388e9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +derbyDb + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store +/derbyDb/ diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..cd748ba --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,15 @@ + + + + + derby.embedded + true + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:derbyDb + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e85157a --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e122dea --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..99de4cb --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/derby.log b/derby.log new file mode 100644 index 0000000..af68c5f --- /dev/null +++ b/derby.log @@ -0,0 +1,13 @@ +---------------------------------------------------------------- +Thu Mar 27 11:16:36 CET 2025: +Booting Derby version The Apache Software Foundation - Apache Derby - 10.17.1.0 - (1913217): instance a816c00e-0195-d71a-8c46-00000ebea748 +on database directory /tmp/ContactsDemo/derbyDb with class loader jdk.internal.loader.ClassLoaders$AppClassLoader@5a07e868 +Loaded from file:/home/jonas/.m2/repository/org/apache/derby/derby/10.17.1.0/derby-10.17.1.0.jar +java.vendor=Oracle Corporation +java.runtime.version=23.0.2+7-58 +user.dir=/tmp/ContactsDemo +os.name=Linux +os.arch=amd64 +os.version=6.6.72 +derby.system.home=null +Database Class Loader started - derby.database.classpath='' diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..755d062 --- /dev/null +++ b/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + at.ionas999 + ContactsDemo + 1.0-SNAPSHOT + + + 23 + 23 + UTF-8 + + + + org.apache.derby + derby + 10.17.1.0 + + + + \ No newline at end of file diff --git a/src/main/java/at/ionas999/Main.java b/src/main/java/at/ionas999/Main.java new file mode 100644 index 0000000..2de33e7 --- /dev/null +++ b/src/main/java/at/ionas999/Main.java @@ -0,0 +1,26 @@ +package at.ionas999; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class Main { + public static void main(String[] args) { + try { + Connection con = DriverManager.getConnection("jdbc:derby:derbyDb"); + con.setAutoCommit(true); + + ResultSet resultSet = con.createStatement().executeQuery("select * from CONTACT"); + + while (resultSet.next()) { + int id = resultSet.getInt(1); + String name = resultSet.getString(2); + System.out.println("Id: " + id + ", Name: " + name); + } + + } catch (SQLException e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file