zoukankan      html  css  js  c++  java
  • springboot 连接 Access数据库

    1、pom中导入maven包

    <dependency>
    <groupId>net.sf.ucanaccess</groupId>
    <artifactId>ucanaccess</artifactId>
    <version>4.0.4</version>
    </dependency>

    2、application.yml配置连接

    spring:
    datasource:
    driver-class-name: net.ucanaccess.jdbc.UcanaccessDriver
    url: jdbc:ucanaccess://D:/xxx/xxx/xxx/Database1.accdb;openExclusive=false;ignoreCase

    3、创建mapper 写sql

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    <mapper namespace="com.orisdom.handle.mapper.HandleMapper">
    <resultMap id="BaseMap" type="com.orisdom.handle.entity.HandleEntity">
    <result column="id" property="id"/>
    <result column="weight" property="weight" />
    <result column="user_name" property="userName" />
    </resultMap>
    <select id="getHandleData" resultMap="BaseMap">
    SELECT id,user_name ,weight FROM [重量] where ID >#{id}
    </select>
    </mapper>

    数据库大致模式(这里只是为了记录配置连接,创建mapper接口,entity等就不需要在贴出来了)

  • 相关阅读:
    网站图片轮播效果
    图片处理类
    字符串处理帮助类
    css3高级选择器
    JQuery选择器大全
    ASCII码表
    jQuery选择器大全
    OpenFileDialog无法弹出的解决方法
    socket学习目录
    ps-抠图
  • 原文地址:https://www.cnblogs.com/xiaokangk/p/13208478.html
Copyright © 2011-2022 走看看