diff --git a/VamPa/pom.xml b/VamPa/pom.xml index 796e701..9f57708 100644 --- a/VamPa/pom.xml +++ b/VamPa/pom.xml @@ -123,6 +123,14 @@ ojdbc8 19.3.0.0 + + + + + com.zaxxer + HikariCP + 3.4.2 + diff --git a/VamPa/src/main/webapp/WEB-INF/spring/root-context.xml b/VamPa/src/main/webapp/WEB-INF/spring/root-context.xml index 8c2b519..6880b3b 100644 --- a/VamPa/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/VamPa/src/main/webapp/WEB-INF/spring/root-context.xml @@ -4,6 +4,17 @@ xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> + + + + + + + + + + + diff --git a/VamPa/src/test/java/com/vam/persistence/JDBCTests.java b/VamPa/src/test/java/com/vam/persistence/JDBCTests.java new file mode 100644 index 0000000..02c187e --- /dev/null +++ b/VamPa/src/test/java/com/vam/persistence/JDBCTests.java @@ -0,0 +1,35 @@ +package com.vam.persistence; + +import static org.junit.Assert.fail; + +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.Test; + +public class JDBCTests { + + static { + try { + Class.forName("oracle.jdbc.driver.OracleDriver"); + }catch(Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testConnection() { + + try(Connection con = + DriverManager.getConnection( + "jdbc:oracle:thin:@localhost:1521:XE", + "c##vam", + "1234")){ + System.out.println(con); + }catch(Exception e) { + fail(e.getMessage()); + } + + } + +} diff --git a/VamPa/src/test/java/com/vam/sample/DataSourceTests.java b/VamPa/src/test/java/com/vam/sample/DataSourceTests.java new file mode 100644 index 0000000..2420987 --- /dev/null +++ b/VamPa/src/test/java/com/vam/sample/DataSourceTests.java @@ -0,0 +1,34 @@ +package com.vam.sample; + +import java.sql.Connection; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml") +public class DataSourceTests { + + @Autowired + private DataSource dataSource; + + @Test + public void testConnection() { + try( + Connection con = dataSource.getConnection(); + ){ + + System.out.println("con="+con); + + }catch(Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 03ec7ea..25f0d93 100644 --- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Sat Aug 08 00:05:22 KST 2020 +#Sat Aug 08 00:16:06 KST 2020 version=1.0.0-BUILD-SNAPSHOT groupId=com.vam m2e.projectName=VamPa diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml index 796e701..9f57708 100644 --- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml +++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml @@ -123,6 +123,14 @@ ojdbc8 19.3.0.0 + + + + + com.zaxxer + HikariCP + 3.4.2 + diff --git a/VamPa_MySQL/pom.xml b/VamPa_MySQL/pom.xml index b817559..fca2307 100644 --- a/VamPa_MySQL/pom.xml +++ b/VamPa_MySQL/pom.xml @@ -117,6 +117,14 @@ 8.0.18 + + + + com.zaxxer + HikariCP + 3.4.2 + + javax.inject diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/spring/root-context.xml b/VamPa_MySQL/src/main/webapp/WEB-INF/spring/root-context.xml index f04d217..014e586 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/spring/root-context.xml @@ -5,6 +5,17 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> + + + + + + + + + + + diff --git a/VamPa_MySQL/src/test/java/com/vam/persistence/DataSourceTests.java b/VamPa_MySQL/src/test/java/com/vam/persistence/DataSourceTests.java new file mode 100644 index 0000000..62eaaa5 --- /dev/null +++ b/VamPa_MySQL/src/test/java/com/vam/persistence/DataSourceTests.java @@ -0,0 +1,34 @@ +package com.vam.persistence; + +import java.sql.Connection; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml") +public class DataSourceTests { + + @Autowired + private DataSource dataSource; + + @Test + public void testConnection() { + try( + Connection con = dataSource.getConnection(); + ){ + + System.out.println("con="+con); + + }catch(Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/VamPa_MySQL/src/test/java/com/vam/persistence/JDBCTests.java b/VamPa_MySQL/src/test/java/com/vam/persistence/JDBCTests.java new file mode 100644 index 0000000..56f250b --- /dev/null +++ b/VamPa_MySQL/src/test/java/com/vam/persistence/JDBCTests.java @@ -0,0 +1,36 @@ +package com.vam.persistence; + +import static org.junit.Assert.fail; + +import java.sql.Connection; +import java.sql.DriverManager; + +import org.junit.Test; + +public class JDBCTests { + + static { + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + } catch(Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testConnection() { + + try(Connection con = + DriverManager.getConnection( + "jdbc:mysql://localhost:3306/ksj?serverTimezone=Asia/Seoul", + "root", + "1234")){ + System.out.println(con); + } catch (Exception e) { + fail(e.getMessage()); + } + + } + + +} diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 6a036d7..ff3492c 100644 --- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Sat Aug 08 00:10:19 KST 2020 +#Sat Aug 08 00:16:25 KST 2020 version=1.0.0-BUILD-SNAPSHOT groupId=com.vam m2e.projectName=VamPa_MySQL diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml index b817559..fca2307 100644 --- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml +++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.xml @@ -117,6 +117,14 @@ 8.0.18 + + + + com.zaxxer + HikariCP + 3.4.2 + + javax.inject