Client Server Sync Scenario - mysql

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?

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

Rails - Does mysql temporary table available between different http request

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.

Socket Server - Sending messages from client to client

I have a socket server set up using Adobe AIR, and I am trying to allow two clients to send messages between each other using the server (this is an Android based project so the server has to act as the middle man on a PC). For some reason, the messages I am sending are only being sent back to the same client it came from, rather than to the other one as well. I have already set up a system to identify where each message has come from, and how to deal with it on the other side.
The variable 'connectionNum' int basically represent whether the client is number 0 or 1, and the data being sent to and from the server has either 0, or 1 in front of it.
Ideally I would like a way to direct data to one specific client at a time, rather than attempting to send it to both with the int at the start of every message.
At the moment, only the second client to connect's messages are actually sent through the server, the first sends a blank message, not sure why.
At the moment, only the second client to connect's messages are actually sent through the server, the first sends a blank message, not sure why.
It is because you only have one clientSocket object on the server and you are overwriting it when someone else connects, so when the second client connects you are losing the first clients socket. When you call sendData on the server it is always using clientSocket which is whoever connected last.
To fix this you need an array of clientSocket objects on the server. Then you can pick the correct one to send a message to or send the message to all clients if you want to broadcast a message.