{"id":11425,"date":"2026-03-04T11:45:28","date_gmt":"2026-03-04T02:45:28","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=11425"},"modified":"2026-03-04T11:46:11","modified_gmt":"2026-03-04T02:46:11","slug":"spring-boot-mysql-%ec%97%90%ec%84%9c-postgresql-%eb%a1%9c-%ec%a0%84%ed%99%98","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=11425","title":{"rendered":"Spring Boot &#8211; MySQL \uc5d0\uc11c PostgreSQL \ub85c \uc804\ud658"},"content":{"rendered":"<h1>Spring Boot &#8211; MySQL \uc5d0\uc11c PostgreSQL \ub85c \uc804\ud658<\/h1>\n<h2>\uc758\uc874\uc131 \ubc0f \uc124\uc815 \ubcc0\uacbd<\/h2>\n<p>\uac00\uc7a5 \uba3c\uc800 <code>build.gradle<\/code> \ub610\ub294 <code>pom.xml<\/code>\uc5d0\uc11c \ub370\uc774\ud130\ubca0\uc774\uc2a4 \ub4dc\ub77c\uc774\ubc84\ub97c \uad50\uccb4\ud574\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<ul>\n<li>\n<p><strong>Dependency \uad50\uccb4<\/strong>:<\/p>\n<\/li>\n<li>\n<p><code>mysql-connector-java<\/code> (\ud639\uc740 <code>mysql-connector-j<\/code>)\ub97c \uc0ad\uc81c\ud558\uace0 <code>org.postgresql:postgresql<\/code>\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n<\/li>\n<li>\n<p><strong>application.yml (\ub610\ub294 properties)<\/strong>:<\/p>\n<\/li>\n<li>\n<p><code>spring.datasource.url<\/code>: <code>jdbc:mysql:\/\/...<\/code>\uc5d0\uc11c <code>jdbc:postgresql:\/\/...<\/code>\ub85c \ubcc0\uacbd\ud569\ub2c8\ub2e4.<\/p>\n<\/li>\n<li>\n<p><code>spring.jpa.database-platform<\/code>: \uba85\uc2dc\uc801\uc73c\ub85c Dialect\ub97c \uc124\uc815\ud588\ub2e4\uba74 <code>org.hibernate.dialect.MySQLDialect<\/code>\uc5d0\uc11c <code>org.hibernate.dialect.PostgreSQLDialect<\/code>\ub85c \ubcc0\uacbd\ud569\ub2c8\ub2e4. (\ucd5c\uc2e0 Hibernate \ubc84\uc804\uc740 \uc790\ub3d9 \uac10\uc9c0\ud558\ubbc0\ub85c \uc0dd\ub7b5\ud574\ub3c4 \ubb34\ubc29\ud569\ub2c8\ub2e4.)<\/p>\n<\/li>\n<\/ul>\n<h2>\uc8fc\uc694 \uae30\uc220\uc801 \ucc28\uc774\uc810<\/h2>\n<p>\ub450 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub294 \uc544\ud0a4\ud14d\ucc98\uc640 \uc0ac\uc591\uc5d0 \uc788\uc5b4 \ucc28\uc774\uac00 \uc788\uc73c\uba70, \ud2b9\ud788 JPA \uc5d4\ud2f0\ud2f0\ub97c \uc791\uc131\ud558\uac70\ub098 SQL \ucffc\ub9ac\ub97c \uc9e4 \ub54c \uccb4\uac10\ub429\ub2c8\ub2e4.<\/p>\n<table>\n<thead>\n<tr>\n<th>\uad6c\ubd84<\/th>\n<th>MySQL<\/th>\n<th>PostgreSQL<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>\ub300\uc18c\ubb38\uc790 \uad6c\ubd84<\/strong><\/td>\n<td>\uc124\uc815\uc5d0 \ub530\ub77c \ub2e4\ub974\uc9c0\ub9cc \uae30\ubcf8\uc801\uc73c\ub85c <strong>\uad6c\ubd84 \uc548 \ud568<\/strong><\/td>\n<td>\uc2dd\ubcc4\uc790(\ud14c\uc774\ube14, \uceec\ub7fc\uba85)\uac00 <strong>\ub300\uc18c\ubb38\uc790\ub97c \uad6c\ubd84\ud568<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>\uc790\ub3d9 \uc99d\uac00 \ud0a4<\/strong><\/td>\n<td><code>AUTO_INCREMENT<\/code> \uc0ac\uc6a9<\/td>\n<td><code>SERIAL<\/code> \ub610\ub294 <code>IDENTITY<\/code> \uceec\ub7fc \uc0ac\uc6a9<\/td>\n<\/tr>\n<tr>\n<td><strong>\ubd88\ub9ac\uc5b8(Boolean)<\/strong><\/td>\n<td><code>TINYINT(1)<\/code>\ub85c \uc800\uc7a5 (0\/1)<\/td>\n<td><strong>Native <code>BOOLEAN<\/code> \ud0c0\uc785<\/strong> \uc9c0\uc6d0 (true\/false)<\/td>\n<\/tr>\n<tr>\n<td><strong>JSON \ub370\uc774\ud130<\/strong><\/td>\n<td>JSON \uceec\ub7fc \uc9c0\uc6d0<\/td>\n<td><strong>JSONB \ud0c0\uc785<\/strong> \uc9c0\uc6d0 (\uc778\ub371\uc2f1 \ubc0f \uac80\uc0c9 \uc131\ub2a5 \ud0c1\uc6d4)<\/td>\n<\/tr>\n<tr>\n<td><strong>\ud45c\uc900 \uc900\uc218<\/strong><\/td>\n<td>\uad00\ub300\ud568 (\ube44\ud45c\uc900 \ubb38\ubc95 \ud5c8\uc6a9)<\/td>\n<td>SQL \ud45c\uc900\uc744 \uc5c4\uaca9\ud558\uac8c \uc900\uc218<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\uac1c\ubc1c \uc2dc \uc8fc\uc758\ud574\uc57c \ud560 \uc810 (\ud568\uc815 \uce74\ub4dc)<\/h2>\n<h3>\ub300\uc18c\ubb38\uc790 \ubb38\uc81c (Case Sensitivity)<\/h3>\n<p>PostgreSQL\uc740 \ud14c\uc774\ube14\uba85\uc774\ub098 \uceec\ub7fc\uba85\uc744 \uc30d\ub530\uc634\ud45c(<code>&quot;<\/code>)\ub85c \uac10\uc2f8\uc9c0 \uc54a\uc73c\uba74 \uae30\ubcf8\uc801\uc73c\ub85c <strong>\uc18c\ubb38\uc790\ub85c \ucc98\ub9ac<\/strong>\ud569\ub2c8\ub2e4.<\/p>\n<ul>\n<li>\ub9cc\uc57d JPA\uc5d0\uc11c <code>@Column(name = &quot;UserName&quot;)<\/code>\ucc98\ub7fc \ub300\ubb38\uc790\ub97c \uc11e\uc5b4 \uba85\uc2dc\ud588\ub2e4\uba74, PostgreSQL\uc740 \uc774\ub97c <code>username<\/code>\uc73c\ub85c \uc778\uc2dd\ud558\uc5ec &quot;\uceec\ub7fc\uc744 \ucc3e\uc744 \uc218 \uc5c6\ub2e4&quot;\ub294 \uc5d0\ub7ec\ub97c \ubc49\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uac00\ub2a5\ud55c \ubaa8\ub4e0 \uc2dd\ubcc4\uc790\ub97c \uc18c\ubb38\uc790(<code>user_name<\/code>)\ub85c \ud1b5\uc77c\ud558\ub294 \uac83\uc774 \uc815\uc2e0 \uac74\uac15\uc5d0 \uc88b\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n<h3>\ub370\uc774\ud130 \ud0c0\uc785 \ub9e4\ud551<\/h3>\n<ul>\n<li><strong>Boolean<\/strong>: MySQL\uc740 <code>TINYINT(1)<\/code>\uc744 \uc4f0\uc9c0\ub9cc, Postgres\ub294 \uc9c4\uc9dc <code>boolean<\/code> \ud0c0\uc785\uc744 \uc501\ub2c8\ub2e4. \uae30\uc874 \ub370\uc774\ud130\uac00 0\/1\ub85c \ub4e4\uc5b4\uac00 \uc788\ub2e4\uba74 \ub9c8\uc774\uadf8\ub808\uc774\uc158 \uc2dc \uc8fc\uc758\ud574\uc57c \ud569\ub2c8\ub2e4.<\/li>\n<li><strong>JSON<\/strong>: Postgres\uc758 <code>JSONB<\/code>\ub294 \ub9e4\uc6b0 \uac15\ub825\ud569\ub2c8\ub2e4. \ub2e8\uc21c\ud788 \ud14d\uc2a4\ud2b8\ub85c \uc800\uc7a5\ud558\uc9c0 \ub9d0\uace0, JPA\uc5d0\uc11c <code>@JdbcTypeCode(SqlTypes.JSON)<\/code> (Hibernate 6 \uae30\uc900)\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc5d4\ud2f0\ud2f0 \ud544\ub4dc\uc5d0 \ub9e4\ud551\ud558\uba74 \ud3b8\ub9ac\ud558\uac8c \uac1d\uccb4\ub85c \ub2e4\ub8f0 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n<h3>\uc2dc\ud000\uc2a4(Sequence) \uc0dd\uc131 \uc804\ub7b5<\/h3>\n<p>MySQL\uc5d0\uc11c\ub294 \uc8fc\ub85c <code>GenerationType.IDENTITY<\/code>\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc758 \uc790\ub3d9 \uc99d\uac00 \uc124\uc815\uc744 \ub530\ub985\ub2c8\ub2e4. PostgreSQL\uc5d0\uc11c\ub3c4 \ub3d9\uc77c\ud558\uac8c \ub3d9\uc791\ud558\uc9c0\ub9cc, <code>GenerationType.SEQUENCE<\/code>\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 Postgres\uc758 \uae30\ubcf8 \ucca0\ud559\uc5d0 \ub354 \uac00\uae5d\uace0, \ub300\ub7c9 \ub370\uc774\ud130\ub97c \uc0bd\uc785\ud560 \ub54c \uc131\ub2a5\uc0c1 \uc774\uc810\uc774 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<hr \/>\n<h2>\uc694\uc57d: \ubb34\uc5c7\uc744 \uba3c\uc800 \ud655\uc778\ud574\uc57c \ud560\uae4c?<\/h2>\n<ol>\n<li><strong>\uae30\uc874 SQL \ucffc\ub9ac<\/strong>: Native Query(\uc9c1\uc811 \uc9e0 \ucffc\ub9ac)\uac00 \uc788\ub2e4\uba74 MySQL \uc804\uc6a9 \ubb38\ubc95(\uc608: <code>IFNULL<\/code>, <code>TINYINT<\/code> \uad00\ub828 \ucc98\ub9ac)\uc774 \ud3ec\ud568\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud558\uace0 \uc218\uc815\ud558\uc138\uc694.<\/li>\n<li><strong>\ub370\uc774\ud130 \ub9c8\uc774\uadf8\ub808\uc774\uc158<\/strong>: \ub9cc\uc57d \uae30\uc874 MySQL \ub370\uc774\ud130\ub97c \uc62e\uaca8\uc57c \ud55c\ub2e4\uba74, \ub2e8\uc21c\ud788 \ub370\uc774\ud130\ub9cc \uc62e\uae30\ub294 \uac83\uc774 \uc544\ub2c8\ub77c \ub370\uc774\ud130 \ud0c0\uc785 \ubcc0\ud658(Type Casting) \uc774\uc288\ub97c \uaf2d \uac80\ud1a0\ud574\uc57c \ud569\ub2c8\ub2e4.<\/li>\n<li><strong>\ub300\uc18c\ubb38\uc790 \ucee8\ubca4\uc158<\/strong>: \uc2dd\ubcc4\uc790 \uc774\ub984\uc744 \uc18c\ubb38\uc790_\uc2a4\ub124\uc774\ud06c_\ucf00\uc774\uc2a4\ub85c \ud1b5\uc77c\ud558\ub294\uc9c0 \ud655\uc778\ud558\uc138\uc694.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot &#8211; MySQL \uc5d0\uc11c PostgreSQL \ub85c \uc804\ud658 \uc758\uc874\uc131 \ubc0f \uc124\uc815 \ubcc0\uacbd \uac00\uc7a5 \uba3c\uc800 build.gradle \ub610\ub294 pom.xml\uc5d0\uc11c \ub370\uc774\ud130\ubca0\uc774\uc2a4 \ub4dc\ub77c\uc774\ubc84\ub97c \uad50\uccb4\ud574\uc57c \ud569\ub2c8\ub2e4. Dependency \uad50\uccb4: mysql-connector-java (\ud639\uc740 mysql-connector-j)\ub97c \uc0ad\uc81c\ud558\uace0 org.postgresql:postgresql\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4. application.yml (\ub610\ub294 properties): spring.datasource.url: jdbc:mysql:\/\/&#8230;\uc5d0\uc11c jdbc:postgresql:\/\/&#8230;\ub85c \ubcc0\uacbd\ud569\ub2c8\ub2e4. spring.jpa.database-platform: \uba85\uc2dc\uc801\uc73c\ub85c Dialect\ub97c \uc124\uc815\ud588\ub2e4\uba74 org.hibernate.dialect.MySQLDialect\uc5d0\uc11c org.hibernate.dialect.PostgreSQLDialect\ub85c \ubcc0\uacbd\ud569\ub2c8\ub2e4. (\ucd5c\uc2e0 Hibernate \ubc84\uc804\uc740 \uc790\ub3d9 \uac10\uc9c0\ud558\ubbc0\ub85c \uc0dd\ub7b5\ud574\ub3c4 \ubb34\ubc29\ud569\ub2c8\ub2e4.) \uc8fc\uc694 \uae30\uc220\uc801 \ucc28\uc774\uc810 \ub450 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub294\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=11425\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-11425","post","type-post","status-publish","format-standard","hentry","category-spring-boot"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11425"}],"version-history":[{"count":2,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11425\/revisions"}],"predecessor-version":[{"id":11427,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/11425\/revisions\/11427"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}