Search

MySQL Inserting, Updating, and Deleting Records through HTTP

There is an original HTTP plugin. The HTTP plugin documents from the labs site make available this material.


The HTTP Plugin for MySQL adds HTTP(S) interfaces to MySQL. Clients can use the HTTP respectively HTTPS (SSL) protocol to query data stored in MySQL. The query language is SQL, but other, simpler interfaces exist. All data is serialized as JSON. This version of MySQL Server HTTP Plugin is a Labs release, which means it’s at an early development stage. It contains several known bugs and limitation and is meant primarily to give you a rough idea how this plugin will look someday. Likewise, the user API is anything but finalized. Be aware it will change in many respects.


In additional words, with a modest HTTP URL, you can entree and change your data kept in MySQL. Here is a summary from the documents:

The HTTP Plugin for MySQL is a proof-of idea of a HTTP(S) crossing point for MySQL 5.7.

The plugin adds a new protocol to the list of protocols understood by the server. It enhances the HTTP correspondingly HTTPS (SSL) protocol to the list of protocols that can be used to issue SQL commands. Clients can now link to MySQL whichever using the MySQL Client Server protocol and programming language-dependent drivers, the MySQL Connectors, or using an random HTTP client.


Outcomes for SQL commands are returned by means of the JSON format.

The server plugin is most valuable in settings where protocols other than HTTP are choked:


  1. JavaScript code run in a browser

  2. an application server behind a firewall and limited to HTTP entree

  3. a web services-oriented setting


In such situations the plugin can be used as an alternative of a self-developed proxy which interprets HTTP requests into MySQL requests. Associated to a user-developed proxy, the plugin means less inactivity, lower complication and the advantage of using a MySQL product. Please message, for very large distributions an architecture using a proxy not combined into MySQL may be a improved solution to plainly distinct software layers and physical hardware used for the changed layers.


The HTTP plugin gears several HTTP interfaces, for example:


  1. plain SQL access with meta data

  2. a CRUD (Create-Read-Update-Delete) interface to interactive tables

  3. an interface for loading JSON documents in relational tables


Some of the crossing point follow Representational State Transfer (REST) ideas, some don’t. See beneath for a report of the several interfaces.


The plugin maps all HTTP entrees to SQL statements within. Using SQL significantly make simpler the progress of the public HTTP interface. Please note, at this initial stage of development routine is not a primary goal. For example, it is likely to develop a comparable plugin that uses lower level APIs of the MySQL server to overwhelm SQL parsing and query planning overhead.


In this blog, I will demonstrate you how to install the plugin and use HTTP commands to recover data. The documents also make available other examples. We aren’t going to clarify the whole thing about the plugin, as you will want to download the documents.

First, you will want to download the MySQL Labs 5.7 version which contains the plugin. This download is presented from the MySQL Labs web site.


After MySQL 5.7 is mounted, you will want to add these lines to your my.cnf/my.ini file under the [mysqld] segment:


There are additional choices for the plugin, nonetheless we will skip them for this blog.


After adjusting the my.cnf/my.ini file, restart mysql and then install the plugin from a mysql prompt. Before going on, be sure to also crisscross to make sure the plugin is mounted:


We will need to generate the user for get into our database, and grant permissions:


We will need to produce a table for our sample. The table will be a actual simple table with three fields – ID, first and last names:


We want to insert some data into the table:


Here and now that we have our table and table data, we can trial a select statement with an HTTP URL. You can use a browser for this, but meanwhile I like to work with command line tools, I am working to use curl, a command line tool for responsibility all sorts of URL operations and transfers. Here is a simple select declaration via curl. Use the plus sign (+) for spaces.


Select all the names in the table:


Selecting a single name:


Deleting a row:


Inserting a row:


THANK YOU for using MySQL:)

0 views

Call

T: +44 7825018241

Follow me

 

© 2020 by GoplarDB 

All Rights Reserved

Powered by: Goplar LTD

  • LinkedIn Social Icon
  • Twitter Clean