JDBC(Java DataBase Connectivity)是基本API,它通过使用Java编程语言执行SQL语句来实现与SQL数据库服务器的交互。
我更改了休眠超时设置以及空闲时间,但它不起作用 我的休眠属性是 5 我更改了休眠超时设置以及空闲时间,但它不起作用 我的休眠属性是 <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.max_size">20</property> <property name="hibernate.c3p0.timeout">300000</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.c3p0.idle_test_period">300000</property> 而且,我遇到以下异常: Exception in thread "main" org.hibernate.exception.JDBCConnectionException: unable to obtain isolated JDBC connection at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:103) at org.hibernate.id.enhanced.TableGenerator$1.getNextValue(TableGenerator.java:530) at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40) at org.hibernate.id.enhanced.TableGenerator.generate(TableGenerator.java:526) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:682) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:674) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:669) at com.ihealthmantra.upload.com.ihealthmantra.customer.upload.service.SellerUploadImpl.lambda$4(SellerUploadImpl.java:801) at java.util.ArrayList.forEach(Unknown Source) at com.ihealthmantra.upload.com.ihealthmantra.customer.upload.service.SellerUploadImpl.createTimeSlotUploadedSeller(SellerUploadImpl.java:738) at com.ihealthmantra.upload.com.ihealthmantra.customer.upload.service.SellerUploadImpl.populateSlot(SellerUploadImpl.java:1146) at com.ihealthmantra.upload.App.main(App.java:81) Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 820,677 milliseconds ago. The last packet sent successfully to the server was 820,679 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3746) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2509) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2480) at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4811) at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:912) at org.hibernate.c3p0.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:78) at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:48) ... 17 more Caused by: java.net.SocketException: Connection reset by peer: socket write error 早些时候工作正常,但随着最近数据的增长,它开始抛出上述异常。 ...服务器是 820,679 毫秒前。比服务器长 “wait_timeout”的配置值... 与数据库服务器的连接似乎比超时设置的值要长。你的例外中也提到了这一点。 要解决此问题,您可以增加超时值或使用 autoReconnect=true 字符串传递 JDBC(如例外中所述) 要更改 MySQL 中的 wait_timeout 值,您可以参考现有帖子。 MySQL wait_timeout 变量 - GLOBAL 与 SESSION 或 将 autoReconnect=true 附加到您的 JDBC URL 字符串 jdbc:mysql://localhost:3306/exodb?autoReconnect=true
如何配置 Squirrel SQL 客户端以与 MS Access 一起使用
我正在努力让 Squirrel SQL 连接到 MS Access 数据库(只是一个普通的数据库,没有密码): 我创建一个别名并使用驱动程序:JBDC ODBC 桥(此驱动程序前面有一个勾号) 我...
JDBCExceptionReporter - SQL 错误:17008,SQLState:08003
我在获取记录时遇到以下错误及其偶发性,它可以通过重新启动服务器或在一段时间后自行修复。我正在使用 Struts 2、Oracle 11g、Hibernate 3。 错误: 20...
我有一个应该使用 SymmetricDS 同步的数据库。有以下查询,构建基础: 创建表 `defectstdreference` ( `std_doc_id` bigint(20) NOT NULL COM...
为什么PreparedStatement给出索引超出范围的错误? [已关闭]
我在 PostgreSQL 中创建了一个有 4 列的表,想要从该表的第 1 列和第 4 列验证我的登录,但它给出了索引超出范围错误。 以下代码在我的
Maven 错误:关闭持久性单元“默认”的 JPA EntityManagerFactory
pom.xml pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>JPAandHybernate</groupId> <artifactId>Learn-JAP-and-hybernate</artifactId> <version>0.0.1-SNAPSHOT</version> <name>Learn-JAP-and-hybernate</name> <description>Demo project for Spring Boot</description> <properties> **<java.version>22</java.version>** </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>**spring-boot-starter-data-jdbc<**/artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>**spring-boot-starter-data-jpa**</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>**spring-boot-starter-web**</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>**h2**</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 控制台输出 09:44:49.895 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [JPAandHybernate.LearnJAPandhybernate.LearnJapAndHybernateApplicationTests]: LearnJapAndHybernateApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration. 09:44:50.034 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration JPAandHybernate.LearnJAPandhybernate.LearnJapAndHybernateApplication for test class JPAandHybernate.LearnJAPandhybernate.LearnJapAndHybernateApplicationTests . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.2.4) 2024-04-20T09:44:50.934+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] J.L.LearnJapAndHybernateApplicationTests : Starting LearnJapAndHybernateApplicationTests using Java 22 with PID 71832 (started by harsha.umashankar in C:\Users\harsha.umashankar\Downloads\Learn-JAP-and-hybernate\Learn-JAP-and-hybernate) 2024-04-20T09:44:50.937+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] J.L.LearnJapAndHybernateApplicationTests : No active profile set, falling back to 1 default profile: "default" 2024-04-20T09:44:52.291+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode 2024-04-20T09:44:52.294+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode. 2024-04-20T09:44:52.325+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 22 ms. Found 0 JDBC repository interfaces. 2024-04-20T09:44:52.351+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode 2024-04-20T09:44:52.353+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2024-04-20T09:44:52.364+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository interfaces. 2024-04-20T09:44:53.124+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2024-04-20T09:44:53.375+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:e71046aa-9390-404f-ac0f-f9c82623e8b7 user=SA 2024-04-20T09:44:53.378+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2024-04-20T09:44:53.461+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2024-04-20T09:44:53.560+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.4.4.Final 2024-04-20T09:44:53.611+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled 2024-04-20T09:44:54.021+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer 2024-04-20T09:44:54.671+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration) 2024-04-20T09:44:54.678+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2024-04-20T09:44:54.979+05:30 WARN 71832 --- [Learn-JAP-and-hybernate] [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2024-04-20T09:44:55.902+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:e71046aa-9390-404f-ac0f-f9c82623e8b7' 2024-04-20T09:44:56.008+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ main] J.L.LearnJapAndHybernateApplicationTests : Started LearnJapAndHybernateApplicationTests in 5.714 seconds (process running for 7.321) WARNING: A Java agent has been loaded dynamically (C:\MyRepoHarsha\net\bytebuddy\byte-buddy-agent\1.14.12\byte-buddy-agent-1.14.12.jar) WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information WARNING: Dynamic loading of agents will be disallowed by default in a future release Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended 2024-04-20T09:44:57.212+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ionShutdownHook] j.**LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit **'default' 2024-04-20T09:44:57.217+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2024-04-20T09:44:57.221+05:30 INFO 71832 --- [Learn-JAP-and-hybernate] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. JPA EntityMANagerFactory 即将关闭。请帮忙解决这个问题 我试图学习 Spring Boot 在 JDBC 和 JPA 上的工作。由于我遇到上述错误,无法继续 你需要添加这个依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>
如何覆盖 Aiven JdbcSinkConnector 上的默认退避期和最大重试次数
我正在使用 Aiven JdbcSinkConnector (io.aiven.connect.jdbc.JdbcSinkConnector) 连接到 Postgres DB。 我想设置自定义退避时间和最大重试次数,但似乎不可能,它
我正在使用 postgresql 并且创建了一些存储过程。现在我想通过jdbc访问存储过程并处理结果。存储过程的结果要么是整数...
使用 Databricks 将 Spark 数据帧写入 Azure SQL Server 数据库时处理重复记录
问题陈述: 我们有一个 Databricks 作业,其中多个任务并行运行。每个任务都将 Spark 数据帧写入 Azure SQL 数据库表。每个任务都会写入自己的目标表......
为什么我无法在 Kotlin 中连接 java.sql.DriveManager?
我想在Kotlin代码中使用java.sql.DriverManager连接MySQL数据库。 这是有关 MySQL 中连接的信息。 连接名称:GCP 用户名:dev 密码:0000 端口:3306 这是我的简单合作...
尝试使用 python jaydeebe api 时出现 SIGBUS 错误
我编写了一个小函数,使用 jaydeebe api/module/library 在 python 中创建 jdbc 连接。我已经在我的个人笔记本电脑(Windows 环境)上测试了它,它创建了连接
如何使用Java preparedStatement更新MySQL时间戳列?
我创建了如下表: 创建表样本(id int not null,created_at 时间戳,updated_at 时间戳,name varchar(100),主键(id)); 尝试以不同的方式更新该列,如
我一直在与 JMeter 合作,为我正在开发的一组 Servlet 进行一些集成测试。我现在有几个测试套件,可以执行不同的场景并在
spring boot : 无法解析导入org.springframework.jdbc.core.JdbcTemplate
我正在尝试使用 springboot 编写的一个测试程序遇到了困难。当我尝试在 DAO 层中导入 JdbcTemplate 类时,出现错误:导入组织。
Pyspark JDBC writer:追加到 SQL 表并将截断模式设置为“true”?
在工作中处理一些代码时,我注意到一个特定的 pyspark 代码块: df.write.format('jdbc')\ .option("截断","true")\ .option( # 连接凭据 ...
是否可以通过 JDBC API 获得 JDBC 级别的 API 支持? 即 3.0、3.1、4.0、4.1、4.2 等... https://en.wikipedia.org/wiki/Java_Database_Connectivity
带有 Hive 连接的 Spring-boot-application 无法启动嵌入式 Tomcat
我使用Spring-Boot,想通过spring-data-hadoop 2.3.0.M1-hdp23将其连接到Hive。问题是,如果我将 hive-jdbc 添加到我的 pom.xml 中,我的应用程序将无法启动。错误日志(部分)是: ...
使用 j-text utils 的 TextTable 类而不是具有 ResultSet 值的表打印结果集时出现异常
尝试下面的代码从java中的ResultSet打印表格但出现错误: 线程“main”java.lang.NoClassDefFoundError 中出现异常: org/apache/commons/lang/StringUtils 在 dnl.utils.text...
在 Oracle 中我可以有这样的 SQL 字符串 从表中选择 *,其中 rownum <= ? Then in a PreparedStatement I can set the rownum as a parameter. How does it work with PostgreSQL JDBC (Java) ...