Rails - Does mysql temporary table available between different http request - mysql

I have written a code to create temporary table on every http request. For the very first request table is created successfully however on the second request it gives me error as Table 'xxx' already exists. when i restarted my local machine server(thin web server) and hit the http request then again temporary table is created without error.
Does this mean that temporary tables are shared between different http request and are destroyed automatically when machine or server is restarted??
Thanks,

As far as I know temporary table exists until connection to the database is closed. In Rais you have a pool of connections to the database and different requests can use different connections.
So if you create temporary table in the first http request, second request can use the same connection and you can receive a SQL error when is trying to create it again, but in second request use another connection temporary table will not exist yet.

Related

how make post from mysql to external client

how can I send json data through a post request to an external client from mysql commands?
POST(select * from clientes)
I need to develop an application and python that listens to a pot from mysql, every time a new row is inserted from a database table, that is, when a trigger is performed

Adding a mysql user store with custom schema to WSO2 Identity Server

Currently, trying to use WSO2 Identity Server to authenticate users from a mysql user store that I created with my own schema. However, whenever I add this user store as a secondary one in WSO2, the users do not appear on the management console.
And when I attempt to authenticate a user from that store I get the error message:
[2019-05-24 10:01:15,951] ERROR{org.wso2.carbon.identity.auth.service.handler.impl.BasicAuthenticationHandler}
- Error occurred while trying to authenticate,
Error when handling event : PRE_AUTHENTICATION
The user stores of the WSO2 servers need to have the specific schema (the schema script located in the dbscripts folder). You need to import users using this from your existing schema or scim2 endpoints to programmably import users
I you cannot migrate user store to wso2 schema as senthalan explained then you have two options to plug custom schema.
Change SQL queries from Advanced option of secondary user store configuration
Writing custom user store manager by extending necessary functions like doAuthenticate, doAddUser [1]
Error when handling event : PRE_AUTHENTICATION basically coming from below listener
org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener in identity.xml while handling pre authenticate event. You can even disable it.
[1]https://github.com/GayanM/custom-user-store

define a link (GET) on trigger

How can I send my mysql table parameters to a link through GET?
e.x. : http:/example.com/Send.ashx?id=[member.id]&name=[class.name]
You cannot access MySQL via http directly. You will need to set up a rest API server that handles http requests, makes the corresponding SQL queries, formats the result (typically as json or XML) and sends it back to the client.
In case you already have an API / web server, we need more detailed information on your setup

Get Browser Information in MySQL Procedure

Is it possible to get browser information in a PROCEDURE via MySQL code?
Without having to pick up via backend code and pass as parameter. That is, does MySQL have any function that returns browser information?
No, it's not possible.
MySQL runs at server side whereas browser info is sent from client side (in request headers). So, unless it's passed to MySQL stored procedure or function (via a web app or php), there is no way MySQL would get the browser information.
Any browser information is going to come in the HTTP request and will need to be passed on by your backend code to your MySQL server. There is no function in MySQL that can give it to you directly because the MySQL server doesn't have access to that information.

Client Server Sync Scenario

I have one table at server side and client side. There are multiple clients.
Fields of table at server are "ID" and "Name"
Fields of table at client are "ID", "Server_ID", "Name" and "Sync"
Now the scenario is :
I send row to server and store row at server database and server send response to client with Server_ID and then i store that row at client database.
Question : What if row is stored successfully at server database but network connection lost and response did not reached at client side?
How to handle this case? How server knows that client did not get response?