
01-Nov-2011
406 Not Acceptable with insert in URL
406 Not Acceptable with insert in URL
I came across HTTP 406 error for the first time, when I named my previous article as \"replace-into-vs-insert-into-on-duplicate-key-update-mysql\"
406 Not Acceptable
An appropriate representation of the requested resource /articles/article/replace-into-vs-insert-into-on-duplicate-key-update-mysql could not be found on this server.
Interestingly, after a lot of (trial-and-error), I found that the word "insert" was the culprit !
When I removed "insert" from the URL seemed to redirect perfectly !
Still do not know the exact issue but will update here once I get to the root of the problem.
Edit 1: Intrestingly, this article with word "insert" in it did not raised 406 Error !
Edit 2: The problem was that my hosting provider had blocked the URL with "insert-into" in URL !
I got the URL whitelisted and mysql-difference-between-replace-into-insert-into-on-duplicate-key-update is resolving fine.
REPLACE INTO and INSERT INTO ... ON DUPLICATE KEY UPDATE
----------------------------------
- Similarity:
-* Both INSERT a row into a database table if PRIMARY KEY or UNIQUE field specified in the SQL, is not present in table.
- Difference:
- If PRIMARY KEY or UNIQUE field specified in the SQL, is already present in table,
-* REPLACE INTO
-** DELETEs the row from the table and then INSERTs a new row with data specified in REPLACE SQL.
-** primary key / uniqe field value is updated.
-** 2 SQL operations are performed.
-** For REPLACE SQL, you need DELETE and INSERT privileges.
-** Data values not present in REPLACE SQL will be set to their default values & older values of the row ( if any ) will be lost.
-* INSERT INTO ... ON DUPLICATE KEY UPDATE
-** UPDATEs the row with data specified in INSERT INTO ... ON DUPLICATE KEY UPDATE SQL.
-** primary key / uniqe field value is updated.
-** Only 1 SQL operation is performed.
source : Impacts of REPLACE INTO
JSONP [JSON with Padding]
----------------------------------
- A solution for Cross-Origin Resource Sharing
- Since <script> tag is an exception to Same-Origin Policy,
some pages use <script> tag to retrieve Javascript code that operates on dynamically-generated JSON-formatted data from other origins.
- This usage pattern is known as JSONP
- The response of JSONP request has Javascript code, which is evaluated by Javascript Interpreter rather than being parsed by JSON parser.
source : JSONP