Get Notified that DB is updated and update feed - java

In mysql is there a way i can get notified about that a table has been updated with this much amount of rows ?
well i need to perform a task to update xml/json feed automatically whyen there is an update in the database .
i searched for few things like calling triggers ,calling a java method from mysql also get notification in python i have checked on SO but i was looking for an approach where less java work will be required to do .doing it from a servlet was an idea for me but doing it from mysql will be good..
any ideas guys ???

a random though, maybe you could do it in your server instead? It seems like you want a simple way rather than a efficent way. I'd recommend trying something like cronjob in linux. Simply make a script in your DB server that query for changes every once and a while, and send some sort of notification(mail?) out when changes detected? I have no idea how complex your script needs to be in order to detect the changes you want, so this might not be the best idea
edit: so basically you want to edit external files with triggers, then maybe UDF is the thing you need.
take a look at this blog and see if that's what you want.

Related

Best way to transfer bulk data

I have 2 requirements, both involving data-transfer.
In the first one I have an application 'A' which has data in its staging table of database, this data has to be transferred to another application 'B'. Here there are around 50k-60k records that need to be transferred daily. I want to know what is the best way to transfer this? should i still follow the old school method of creating a file and transferring it or go for web-API's or anything else? Please suggest anything in JAVA.
In the second one, i have a file that needs to be transferred from app 'A' to app 'B'. The file size is of around 10GB. what is the best way of achieving it? I had a look at IBM ESB, is there any other better alternate?
This is best done outside of any API because it will likely take quite a bit of time.
My suggestion is to export the data to csv, zip it up, transfer it to the other system via ftp for example.
On the second system you would need something which monitors the folder where you ftp stuff and this other thing would take care of getting the data into the second system. I have setup such a system using the Azure cloud for example using Webjobs and it worked very well.
You can also come up with something else which is appropriate to your specific case.

Want to transfer information contained in a database in one iteration of an app to another iteration on a different phone

I consider myself an accomplished programmer, but I'm relatively new to Android App development. I'm creating an application that will store information into the SQLite database used in Android. What I'd like to be able to do is be able to take a query of that data and export it either as a file of some sort or just send it to another iteration of the same application on a different phone. Then be able to have that phone import the same information into its own database, seeing that the information should line up correctly as long as it keeps it.
Can anyone provide some good starting examples of how I would best go about this and/or tutorials on how to go about doing it? Right now I'm just not sure how to get started and I could use some help to push me in the right direction, so I'd really appreciate the help.
Thank you ahead of time to anyone who replies.
and export it either as a file
depends on what kind of data you have. You can write any kind of text-based data using a RandomAccessFile for example.
send it to another iteration of the same application on a different
phone
You will need to have your own backend to do so. You could identify the target device by using GCM

How would I go about Transfering data between JAVA and PHP?

I have a java application that has information that I need to display on a webpage, sorta like a chat room, The way I'm currently doing it is by having the java application listen for connections on a specific port and then I have a PHP script that connects every second to update the information listed on the page, What I'm trying to find out is there a better way of doing this? I haven't done anything like this before so sorry If this method is really stupid, I'm just looking for the best way to accomplish this. All constructive comments are welcome.
EDIT:
I forgot to mention that I'm doing this over TCP and I do not have access to MySQL so I can't store anything In a database then have the PHP script go and retrieve it..
Well it depends strongly on the flow, when should the communicate? If PHP needs data from Java then just do a call and parse the data back in xml's. Else if it is a lot like a chat, there should be a way to socket it, although I have never tried it.

How to write a simple gridview in java?

I wrote sql but it takes more time when execute it in jsp. And I want to make faster it. Will grid view make the page faster?
I'm junior in Java. I researched in google but didn't find clear sample about gridview. Can u help me?
I understand you have a web based application backed by the DB.
Note that gridview is not something offered by Java, instead you can create tables by using your web frameworks and render data there.
You say, it takes a lot of time to execute an SQL when running withing JSP. Where the time goes?
Running the SQL itself? Maybe creating a JSP or transmitting it to the client browser in an Html form, or even maybe the rendering of your table in browser?
You should detect the bottleneck in order to understand what you're going to fix
Consider to use profiler and see (at least on server vm) where the time goes.
I think JVisualVM will suit your needs here.
Hope this helps
I would have done this task using following steps
Create one servlet.
Connect to the database and fetch the data which we have to display.
Create a list and keep the data in list it.
Set the list in request and forward the control to JSP.
On JSP, use DisplayTag to show the data in grid form.
Hope this helps you.

Wrting Objects to a file and searching through them in an Android App

I want to create an android that allows the user to enter data, like name and id number. I want to save that data as an object, to a file. I know I can do that using ObjectOutputStream, which I did, and it works. However, I also want the user to come back later, be able to add more entries to the same file, and search through his/her previous entries. I know that only RandomAccessFile has that capability, but I still want to write objects since it's easier to deal with.
Does anyone have any tips on what's the best way to approach this?
I am aware of this post, but I am not sure if I can use the libraries mentioned there on android. I was also looking at SQLite, but I have no experience with it and I am not sure if it's the right option for me.
Thanks in advance!

Categories

Resources