MyBatis database connection pool will throw a null pointer exception if the driver class is not configured

Visto 17 veces
Saltar al primer mensaje no leído

Jackie Gu

no leída,
18 may 2021, 0:01:4918/5/21
a mybatis-user
UnpooledDataSource class initializeDriver method, if a member variable "driver" is null, then the "registeredDrivers.containsKey(driver)" code will throw null pointer exception,  When the DefaultSqlSession's method catches the exception, the exception thrown has been modified to "Error querying database".

M Huzaifah

no leída,
19 may 2021, 10:07:1319/5/21
a mybati...@googlegroups.com
Hi,

Then configure you driver class. How come you want to connect to database without knowing you database system that you use. I dont get your point. The driver class should be required when you try to connect to database.

Regards

Pada tanggal Sel, 18 Mei 2021 11.01 AM Jackie Gu <jack...@gmail.com menulis:
UnpooledDataSource class initializeDriver method, if a member variable "driver" is null, then the "registeredDrivers.containsKey(driver)" code will throw null pointer exception,  When the DefaultSqlSession's method catches the exception, the exception thrown has been modified to "Error querying database".

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/a85ab528-5a52-46af-87fb-74fafb4ad8e4n%40googlegroups.com.

Jackie Gu

no leída,
24 may 2021, 11:13:1724/5/21
a mybati...@googlegroups.com
Hi,
I mean Is driver class can be set to the optional configuration items, because the JDK DriverManager when to get the datasource connection, automatically traverses the registered through SPI mechanisms driver classes, such as: MySQL's com.mysql.cj.jdbc.Driver. This is already happening in Spring JPA.And while DriverManger would have thrown a correct exception if the driver class had been incorrectly configured, it is now throwing an exception that can mislead the lookup problem.

M Huzaifah <mhuzaif...@gmail.com> 于2021年5月19日周三 下午10:07写道:
You received this message because you are subscribed to a topic in the Google Groups "mybatis-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mybatis-user/D1PQSwxUvvA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2B0qJZt%3DxVLkTeJMV6FZJyBA43o3yeKQUDxsmVP0_0ESnxDbKQ%40mail.gmail.com.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos