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/10 13:28:52 UTC

[GitHub] [shardingsphere] natehuangting commented on issue #22015: MySQL executes Preparestatement null pointer exception

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