You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/08 11:38:33 UTC
[GitHub] [shardingsphere] natehuangting opened a new issue, #22015: MySQL executes Preparestatement null pointer exception
natehuangting opened a new issue, #22015:
URL: https://github.com/apache/shardingsphere/issues/22015
### Which version of ShardingSphere did you use?
master
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy
### Actual behavior
```
[ERROR] 2022-11-08 19:35:46.983 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because "databaseName" is null
at org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData.getDatabase(ShardingSphereMetaData.java:86)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.prepare.MySQLComStmtPrepareExecutor.execute(MySQLComStmtPrepareExecutor.java:70)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### Reason analyze (If you can)
connectionSession.getDatabaseName() returns null
<img width="1547" alt="image" src="https://user-images.githubusercontent.com/26433395/200554384-0aa953d8-ceb2-4b4e-9c4e-65c500c4a61f.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN closed issue #22015: MySQL executes Preparestatement null pointer exception
Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #22015: MySQL executes Preparestatement null pointer exception
URL: https://github.com/apache/shardingsphere/issues/22015
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #22015: MySQL executes Preparestatement null pointer exception
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #22015:
URL: https://github.com/apache/shardingsphere/issues/22015#issuecomment-1308207020
Hi @natehuangting
Could you describe details about how to reproduce this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] natehuangting commented on issue #22015: MySQL executes Preparestatement null pointer exception
Posted by GitBox <gi...@apache.org>.
natehuangting commented on issue #22015:
URL: https://github.com/apache/shardingsphere/issues/22015#issuecomment-1310283270
> Hi @natehuangting Could you describe details about how to reproduce this issue?
Cannot reproduce using JDBC, you need to use go language
```
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
testMySQL()
}
func testMySQL() {
DB, _ := sql.Open("mysql", "root:root@tcp(127.0.0.1:3307)/?charset=utf8")
if err := DB.Ping(); err != nil {
fmt.Println("open database fail")
return
}
fmt.Println("connect success")
query(DB)
}
func query(db *sql.DB) {
sqlStr := "select * from sharding_xa.t_order where user_id in ?"
rows, err := db.Query(sqlStr, 1, 2)
if err != nil {
fmt.Printf("query failed, err:%v\n", err)
return
}
if rows.Next() {
fmt.Print(1)
}
fmt.Println(rows)
rows.Close()
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org