使用Oracle的springBoot

application.yml

spring:
  application:
    name: zplatform
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@主机号:端口号/数据库?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
    username: 用户
    password: 密码

pom.xml

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <scope>12.2.0.1</scope>
        </dependency>
        <dependency>
        <groupId>com.oracle.database.nls</groupId>
        <artifactId>orai18n</artifactId>
        <version>19.7.0.0</version>

oracle语句

//查询数据库中全部表
select * from tabs

//查询表的列
select column_name from user_tab_columns where table_name='表名'

//查询表的数据
select * from 表名

//查询表中数据的条数
SELECT count(*) FROM 表名

//分页查询
SELECT * FROM
    (
        SELECT a.*,rownum rn
        from (SELECT * FROM  表名) a
        WHERE #{结束条数} >= rownum
    )
WHERE  rn > #{开始条数}

posted @ 2023-04-21 13:11  徐滨  阅读(51)  评论(0编辑  收藏  举报