JAVA + MYBATIS + MYSQL 이다.
Postgresql 을 사용하려면 JDBC 연결 파일을 바꾸면 된다.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias alias="Person" type="com.hmkcode.vo.Person"/>
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<!-- connecting to Local MySql -->
<dataSource type="POOLED">
<property name="driver" value ="org.postgresql.Driver"/>
<property name="url" value ="jdbc:postgresql://127.0.0.1:5432/postgres"/>
<property name="username" value="postgres"/>
<property name="password" value="postgres"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/hmkcode/mybatis/mapper/Person.xml"/>
</mappers>
</configuration>
CREATE TABLE public.persons
(
id integer,
name text
)
테이블을 위와 같이 만들었다.
근데
person.setName("Person 1");
//( 1 ) insert person
personDAO.insert(person); // 여기서 에러가 난다.
일단 업무 때문에 확인은 나중에 한다.
http://hmkcode.com/java-mybatis-mysql/
rar 압축 파일을 제공한다.
구글은 철저히 영어 기반 검색이다.
라는 것을 느낀다.
중국인들은 영어를 요즘 열심히 공부하고 있는 것 같다.