mysql 오류 해결

7560 단어 idea
1.오류 알림
my batis 코드 생 성 도 구 를 사용 할 때 시간 대 오류 알림 은 다음 과 같 습 니 다.
C:\springinit\demo\src\main\java>java -jar mybatis-generator-core-1.3.7.jar -configfile generatorConfig.xml -over
write
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. Th
e driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one t
ime zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to
use a more specifc time zone value if you want to utilize time zone support.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
        at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:455)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
        at org.mybatis.generator.internal.JDBCConnectionFactory.getConnection(JDBCConnectionFactory.java:84)
        at org.mybatis.generator.config.Context.getConnection(Context.java:542)
        at org.mybatis.generator.config.Context.introspectTables(Context.java:446)
        at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:257)
        at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:189)
        at org.mybatis.generator.api.ShellRunner.main(ShellRunner.java:117)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '???ú±ê×??±
??' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (v
ia the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time z
one support.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
        at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
        at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234)
        at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258)
        at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
        ... 9 more


2.해결 방법
jdbc Connection 설정,server imezone 설정 추가
아래 와 같다
       
        
            
        

4.567913.데이터베이스 설정 표 user 가 가리 키 는'데이터베이스 이름'은 test.user,mdblog.user 가 다르다 는 것 을 나타 낸다.그렇지 않 으 면 헷 갈 릴 수 있다.4.다시 한 번



    
    
    
        
            
            
            
        
        
        
            
        
        
            
        
        
        
            
            
        
        
        
            
        
        
        
            
        
        
        

3.

C:\springinit\demo\src\main\java>java -jar mybatis-generator-core-1.3.7.jar -configfile generatorConfig.xml -overwrite
Table Configuration user matched more than one table (mdblog..user,mysql..user)
Cannot obtain primary key information from the database, generated objects may be incomplete
Cannot obtain primary key information from the database, generated objects may be incomplete
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\domain\User.java was overwritten
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\IDao\UserMapper.java was overwritten

MyBatis Generator finished successfully, there were warnings.
5.부록
C:\springinit\demo\src\main\java>java -jar mybatis-generator-core-1.3.7.jar -configfile generatorConfig.xml -overwrite
Table Configuration mdblog.user matched more than one table (mdblog..user,mysql..user)
Cannot obtain primary key information from the database, generated objects may be incomplete
Cannot obtain primary key information from the database, generated objects may be incomplete
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\domain\User.java was overwritten
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\IDao\UserMapper.java was overwritten
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\domain\User.java was overwritten
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\domain\UserWithBLOBs.java was overwritten
Existing file C:\springinit\demo\src\main\java\.\cn\goingtodo\IDao\UserMapper.java was overwritten

MyBatis Generator finished successfully, there were warnings.
자동 생 성 이 쉽 지 않 네요.더 듬 어 봤 는데...

좋은 웹페이지 즐겨찾기