简体   繁体   English

从spring boot应用程序连接到oracle数据库时如何解决“驱动程序不支持获取/设置连接网络超时”的问题?

[英]How to fix "Driver does not support get/set network timeout for connections" while connecting to oracle database from spring boot app?

I was trying to connect to my table and insert some data.We are using oracle database.我试图连接到我的表并插入一些数据。我们正在使用 oracle 数据库。 In the code I have used oracle thin driver ojdbc14.I am getting在代码中,我使用了 oracle 瘦驱动程序 ojdbc14。我得到了

2018-12-27 11:08:58.810  INFO 16548 --- [           main] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Driver does not support get/set network timeout for connections. (oracle.jdbc.driver.T4CConnection.getNetworkTimeout()I)
2018-12-27 11:08:58.810 ERROR 16548 --- [           main] com.zaxxer.hikari.pool.PoolBase          : HikariPool-1 - Failed to execute isValid() for connection, configure connection test query (oracle.jdbc.driver.T4CConnection.isValid(I)Z).

I am fairly new to spring boot and was actually trying to我对 spring boot 还很陌生,实际上是在尝试

do this demo - https://www.devglan.com/spring-jdbc/working-with-springboot-jdbctemplate做这个演示 - https://www.devglan.com/spring-jdbc/working-with-springboot-jdbctemplate

only changes I have done is in my pom.xml and application.properties.我所做的唯一更改是在我的 pom.xml 和 application.properties 中。

Is there any thing else needed for oracle? oracle 还需要什么东西吗? How i should solve this?All the example I see for oracle in net is with hibernate.Is is necessary to include hibernate approach?我应该如何解决这个问题?我在网络中看到的所有 oracle 示例都是使用 hibernate。是否有必要包含 hibernate 方法? Thank you in advance.先感谢您。


pom.xml pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <dependencies>
        <dependency>
         <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <!-- <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency> -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- HikariCP connection pool -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.2.0</version>
        </dependency>

    </dependencies>

application.properties应用程序属性

spring.datasource.url=jdbc:oracle:thin:@//url/service
spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver

That is because you are using a very old version of ojdbc.那是因为您使用的是非常旧版本的 ojdbc。 You should be using the latest versions of the Oracle JDBC driver to connect to your Oracle database.您应该使用最新版本的 Oracle JDBC 驱动程序连接到您的 Oracle 数据库。

From a quick test here:从这里的快速测试:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Hikari 驱动程序不支持获取/设置连接的网络超时。 (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I) - Hikari Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I) HikariPool-1 - 驱动程序不支持获取/设置连接的网络超时。 (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I) - HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I) 运行 1 个 spring 引导应用程序时创建了多个 ORACLE 数据库连接 - Multiple ORACLE DB connections created while running 1 spring boot app 如何在 Spring Boot 应用程序中设置 oracle db 连接超时 - How to set oracle db connection timeout in spring Boot application 如何在 Spring Boot 应用程序中使用 oracle 驱动程序并使用 docker 进行部署 - How to use oracle driver in a spring boot app and deploy using docker 从Spring Boot查询Oracle数据库时表名称无效 - invalid table name while consulting a oracle database from spring boot 在与mongo驱动程序连接时,Spring boot mongo超时 - Spring boot mongo time out while connecting with mongo driver 制作Spring Boot应用程序以从现有的oracle数据库加载数据吗? - Making a spring boot app to load data from an existing oracle database? 使用 Spring 引导从 Oracle 数据库获取实体不起作用 - Use Spring Boot get entity from Oracle DataBase not work java.lang.ClassNotFoundException:连接 oracle 数据库时 Servlet 中的驱动程序 - java.lang.ClassNotFoundException: driver in Servlet while connecting oracle database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM