zoukankan      html  css  js  c++  java
  • 01_1_准备ibatis环境

    01_1_准备ibatis环境

    1. 搭建环境:导入相关的jar

    mysql-connector-java-5.1.5-bin.jar(mysql)或者ojdbc6.jar(oracle)ibatis-2.3.3.720.jar

    2. 配置文件

    2.1jdbc连接的属性文件

    SqlMap.properties

    driver=oracle.jdbc.driver.OracleDriver

    url=jdbc:oracle:thin:@127.0.0.1:1521:orcl

    username=scott

    password=scott

    2.2总配置文件

    SqlMapConfig.xml

    <!DOCTYPE sqlMapConfig        

        PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"        

        "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">  

    <sqlMapConfig>  

        <properties resource="config/SqlMap.properties" />  

        <transactionManager type="JDBC">  

            <dataSource type="SIMPLE">  

                <property name="JDBC.Driver" value="${driver}" />  

                <property name="JDBC.ConnectionURL" value="${url}" />  

                <property name="JDBC.Username" value="${username}" />  

                <property name="JDBC.Password" value="${password}" />  

            </dataSource>  

        </transactionManager>  

        <sqlMap resource="config/map/Student.xml" />  

    </sqlMapConfig>  

    2.3每个实体的映射文件(map文件)

    Student.xml

    <?xml version="1.0" encoding="UTF-8" ?>  

    <!DOCTYPE sqlMap        

        PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"        

        "http://ibatis.apache.org/dtd/sql-map-2.dtd">  

    <sqlMap>  

      <typeAlias alias="Student" type="entity.Student"/>

      <select id="selectAllStudent" resultClass="Student">

       select * from student

      </select>

    </sqlMap> 

  • 相关阅读:
    Animate.css 一款强大的预设css3动画库
    关于js返回上一页的实现方法
    jquery判断字符串中是否包含特定字符的方法总结
    去掉select在苹果手机上的原生样式
    html5中如何去掉input type date默认样式
    JS和jQuery中ul li遍历获取对应的下角标
    滚动一定的高度底色递增
    喵哈哈村的狼人杀大战(5)
    喵哈哈村的狼人杀大战(2)
    One Card Poker
  • 原文地址:https://www.cnblogs.com/flyback/p/8659916.html
Copyright © 2011-2022 走看看