I create a websocket server with Java in my localhost and i create android app connect with the websocket server and i have database in another web hosting how can the websocket server detect any update in the database ?
Asked
Active
Viewed 3,625 times
0
-
so, the main question how the database is accessed ? in another words how do you (insert, update,delete) data from database ? do you use Java or which language ? – Anas Aug 07 '17 at 19:20
-
Nn i mean how the websocket server know if the data in the database change(updated or deleted... ) or not – MøĦâméd Ğhøùdiï Aug 07 '17 at 19:24
-
Without looking at your code, we have no clue. We need to see how you change data in the database to answer this – Rabbit Guy Aug 07 '17 at 19:29
1 Answers
1
According the fellowing links on stack overflow
MS SQL server doesn't fire any notification that can be observed via Java applications as here in comments
so what we can do ? create our own listeners!
and we have two assumptions
If you make operations(insert,update...) on database via an applications: hence you can create a
webservice
on your Java server and the applicationconsumes(ie:call) this web service
when a new data is updated, and theweb service
will notify theweb-socket
instancesIf the database is accessed directly from the DBMS, so MS SQL Server triggers can only invoke only
CLR
as mentioned here so you need to create aTimer
usingEJB
that observes the database but this will be the worst solution
I hope this to be useful (:

Anas
- 688
- 7
- 24