You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

数据库服务器连接报错求助:ArrayIndexOutOfBoundsException异常

Troubleshooting ArrayIndexOutOfBoundsException in Database Connection

First off, let’s break down the issues in your configuration that are likely causing this database connection error:

  • Malformed JDBC URL (the primary culprit)
    Looking at your spring.datasource.url, there’s a critical syntax mistake. You’ve written jdbc:mysql://159.65.200.68:3306/timYcreateDatabaseIfNotExist=true — notice that after your database name timY, you’re missing a ? to separate the database path from the query parameters. This breaks the URL parser, which tries to split parameters incorrectly and throws an ArrayIndexOutOfBoundsException. Fix it to:

    spring.datasource.url=jdbc:mysql://159.65.200.68:3306/timY?createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&autoReconnect=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    
  • Deprecated Hibernate Naming Strategy
    The property spring.jpa.hibernate.naming_strategy is outdated in newer Spring Boot versions. Replace it with a modern alternative based on your needs:

    • For physical naming (controls how database tables/columns are named):
      spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
      
    • For implicit naming (maps entity names to database names):
      spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
      

    If you specifically need the old EJB3 behavior, you can keep org.hibernate.cfg.EJB3NamingStrategy but note it’s no longer maintained.

  • Truncated Database Platform Property
    Your spring.jpa.database-p... is cut off. Complete it to specify the correct Hibernate dialect for your MySQL version, like:

    spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
    

    (Use MySQL5Dialect if you’re on an older MySQL version.) This ensures Hibernate generates SQL compatible with your database.

After fixing these, restart your app and see if the exception goes away. If it persists, share the full stack trace of the ArrayIndexOutOfBoundsException — that’ll help us dig deeper into driver version issues or other connection-related code problems.

内容的提问来源于stack exchange,提问作者abstract christmas tree

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:41:25