diff --git a/go.mod b/go.mod index e01fbd7..87d02b9 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module DataInputClient go 1.17 -require github.com/go-sql-driver/mysql v1.6.0 // indirect +require github.com/go-sql-driver/mysql v1.6.0 diff --git a/main.go b/main.go index acc9a38..2730028 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" "os" + + _ "github.com/go-sql-driver/mysql" ) func main() { @@ -18,10 +20,11 @@ func main() { fmt.Println(string(jsonString), x) //Open a connection to the database - db, err := sql.Open("mysql", "") + db, err := sql.Open("mysql", "root:@tcp(:3306)/EFB") if err != nil { - + fmt.Println(err) } + defer db.Close() //Make a Query to the database db.Exec("INSERT INTO ") //Close the connection