Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions a.txt

This file was deleted.

28 changes: 18 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
group 'kr.ac.jejunu'
version '1.0-SNAPSHOT'

apply plugin: 'java'
plugins {
id 'java'
}

sourceCompatibility = 1.8
group = 'kr.ac.jejunu'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
mavenCentral()
}

test {
useJUnitPlatform()
}

ext {
springVersion = '4.2.5.RELEASE'
springVersion = '5.2.5.RELEASE'
}

dependencies {
compile group: 'org.springframework', name: 'spring-context', version: springVersion
compile group: 'org.springframework', name: 'spring-jdbc', version: springVersion
runtime group: 'mysql', name: 'mysql-connector-java', version: '5.1.37'
testCompile group: 'junit', name: 'junit', version: '4.11'
implementation "org.springframework:spring-core:${springVersion}"
implementation "org.springframework:spring-context:${springVersion}"
implementation "org.springframework:spring-jdbc:${springVersion}"
runtimeOnly 'mysql:mysql-connector-java:8.0.19'
testImplementation 'org.hamcrest:hamcrest:2.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Apr 18 10:12:35 KST 2016
#Thu Apr 18 11:30:56 KST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
164 changes: 0 additions & 164 deletions gradlew

This file was deleted.

90 changes: 0 additions & 90 deletions gradlew.bat

This file was deleted.

2 changes: 0 additions & 2 deletions settings.gradle

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/kr/ac/jejunu/userdao/User.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package kr.ac.jejunu.userdao;

public class User {
private Long id;
private Integer id;
private String name;
private String password;

public Long getId() {
public Integer getId() {
return id;
}

public void setId(Long id) {
public void setId(Integer id) {
this.id = id;
}

Expand Down
24 changes: 11 additions & 13 deletions src/main/java/kr/ac/jejunu/userdao/UserDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@
import java.sql.*;

public class UserDao {
public User get(Long id) throws ClassNotFoundException, SQLException {
//데이터는어디에? Mysql
//Driver Class Load
Class.forName("com.mysql.jdbc.Driver");
// Connection 접속정보는? localhost jeju id : jeju pw: jejupw
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/jeju", "jeju", "jejupw");
// 쿼리만들고
PreparedStatement preparedStatement = connection.prepareStatement("select * from userinfo where id = ?");
public User get(Integer id) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost/jeju?serverTimezone=UTC"
, "jeju", "jejupw");
PreparedStatement preparedStatement =
connection.prepareStatement("select * from userinfo where id = ?");
preparedStatement.setLong(1, id);
// 실행

ResultSet resultSet = preparedStatement.executeQuery();
resultSet.next();
// 결과매핑

User user = new User();
user.setId(resultSet.getLong("id"));
user.setId(resultSet.getInt("id"));
user.setName(resultSet.getString("name"));
user.setPassword(resultSet.getString("password"));

//자원을 해지한다.
resultSet.close();
preparedStatement.close();
connection.close();

//리턴
return user;
}
}
25 changes: 0 additions & 25 deletions src/test/java/kr/ac/jejunu/userdao/UserDaoTest.java

This file was deleted.

Loading