Using the database/sql package with MySQL

Relational databases are some of the most well understood and common database options. MySQL and PostgreSQL are two of the most popular open-source relational databases. This recipe will demonstrate the database/sql package, which provides hooks for a number of relational databases and automatically handles connection pooling and connection duration, and gives access to a number of basic database operations.

This recipe will make use of a MySQL database to establish a connection, insert some simple data, and query it. It will clean up the database after use by dropping the table.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.157.186