Rails has made our lives easier. If we are talking in terms of querying the database, the active record has got us covered. But what if we had to communicate with an external database?

Recently in one of the projects that I worked on, I had to perform insert, update, select, and other different queries to the external MariaDB server and I didn’t know what to do. I figured out that it would be easy if I created a service that can work like ORM to perform the query I wanted.

Skills required to follow the tutorial

Intermediate in:

  • Rails
  • SQL

Requirements

  • Service to connect with external MySQL server
  • Perform basic query: select, insert, and update
  • Prepared statement
  • Perform transaction
  • Perform join query

#mysql #sql #mysql servers

How to Connect With External MySQL Servers: Select Operations
1.15 GEEK