0

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 ?

  • 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 Answers1

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

  1. If you make operations(insert,update...) on database via an applications: hence you can create a webservice on your Java server and the application consumes(ie:call) this web service when a new data is updated, and the web service will notify the web-socket instances

  2. If the database is accessed directly from the DBMS, so MS SQL Server triggers can only invoke only CLRas mentioned here so you need to create a Timer using EJB that observes the database but this will be the worst solution

I hope this to be useful (:

Anas
  • 688
  • 7
  • 24