Couchbase clarification - couchbase

I am running into a problem using couchbase, but it may be because I don't quite understand how couchbase works. I have created a simple console .NET app to do some simple stores and gets on data. The problem I am having is when I close the app, then restart it and try to get data I previously stored, it will not retrieve any data. But, if I store and then get before closing the app, it returns data. Can anyone offer me clarification? Thanks!

Found my problem... I was not disposing of the client properly. I had the client as a member of another class, which is what I had in my using statement, so I guess that does not properly dispose.

Related

NodeJS Emit when a row is added to database table

I am quite new to NodeJS but I've written a few apps (like a chat, real time page updater etc) And I've used mysql to read from my database and emit() information to my webpage, but how can I have nodeJS watch a database table and emit() whenever a row is added?
I have no idea where to start and google didn't produce much results. However there must be an include I can require() that will watch the database in someway.
The answer really isn't a nodejs question, but a mysql question. If mysql itself can tell you ( via an event or log ) that a row was added, nodejs could read and consume that data. Unfortunately, that doesn't seem to be possible, based on this answer. The answer suggests that the only thing you can do with mysql is to poll for new rows.
IF you're in control of inserting the data rows from nodejs itself, there shouldn't be any problem emitting those events after you get the confirmation it wrote, but I do not have enough information on your project to know what constraints you have.
UPDATE: Nice little npm package https://www.npmjs.com/package/live-sql seems to solve your problem I hope

Jira REST API to MySQL request

Is it possible to get data through REST API from Jira directly to mysql without using rest client in Java/Python etc?
I need to get and regularly update data from there to my database.
I'd have to say no but I could be wrong. You're looking for the ability of mysql to run something like PHP, java, python, vb that could access another server and pass the results to a SQL script.
However, even if you could do it, I don't think it's a very good idea because there is probably more complexity to the problem than you envision right now. There will be issues of outages, backups, picking up where you left off, changing current issues when status changes, new comments, etc. The only way to guarantee synchronization is to dump the jira database and load it completely into your database, something a REST API isn't really intended to do. If you have access to the JIRA system, just ask them for a database dump. If your using someone else jira system, they probably won't appreciate the load you will place on their API and will shut you out.

Connecting visual c++ to an online database

I am working on an app in visual c++ which requires data to be accessed from a database which can be edited so that every time there is a modification to the data I do not have to resend the app as it will automatically update, it is also required that this is a desktop app.
I am currently using MySql however for this to run constantly I will be needing a server which for a single simple app wont really be worth purchasing, so I started thinking of alternative methods and thought to myself there must be some method of reading directly from a website or online database, am I correct in thinking this? If so could someone please explain how I would achieve this?
Also, I have purchased phpmyadmin in the past so if there is any way I could connect my visual c++ app to a database from this then that would be great.
EDIT: Note, this app relies almost entirely on the database as it is just 3 combo box's and one text field all of that values for which come from the database.
The following response is assuming that by online you mean on the web.
You cannot exactly 'connect' to an online database with C++ (or anything outside of that server hosting the database).
What I would do is create some PHP API's that you can POST to with libcurl via C++. You can both send and receive data this way.

how to call a java action when changes in databse

hii i am working on spring and hibernate, i have a situation when i want to call a method when changes is done in data base means like notification whenever a new notification is come then my page automatically show the no of notification, i have done this work using timer but its not good it because it call repeatedly and load on server is increased unusually so please tell me is there any way to listen the data base and call the method only when a new entry ios done or any change is made on data base
You have two options:
Trigger from database to java program using sys_exec():
see https://github.com/mysqludf/lib_mysqludf_sys
Use an hibernate entity listener. This only work if hibernate has excusive access to database.
see http://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/listeners.html
If I've understood your question correctly, you have a web interface which should show a notification, if there's a new DB entry?
Then you've first got to choose one of Jose Luis Martin's suggestions, in order to have the notification on the server side. And then you have to forward this notification to the client. For this there are a few possibilities:
(What you already did): Use polling (sending a request from client to server every x seconds, asking for new entries): http://en.wikipedia.org/wiki/Polling_(computer_science)
Let the server push the data to the client. This is the more "modern" solution: http://en.wikipedia.org/wiki/Push_technology
I'd suggest using the second approach in combination with some framework like Atmosphere: https://github.com/Atmosphere/atmosphere
This framework supports several different ways of communication, with fallbacks etc.
EDIT:
If you really just want the information inside a server method, and the information hasn't to be 100% precise, you could also use a timer on the server to count the new items every 30 seconds and kinda cache the result for the client requests.

How to avoid data caching when querying the database?

I'm having a strange problem with ASP.NET MVC4 and Entity Framework 5: The web application I'm building retrieves data from a database and sends it as Json into a viewmodel on the page, from which it then gets presented in a table on the page. The data represents the state of some datapoints that change every now and then.
Now I observed the following behaviour:
when I run the web application from my development server, everything works fine and the shown data is up to date.
when I deploy the web app to a production server (which talks to the very same DB), the page does not represent the current state of the data
I can't breakpoint the controller method that retrieves the data, as it only occurs on the production server, but when I look into the Json data I can see that it actually is old data. So it seems like EF is caching the retrieved data. This is a serious problem as we use this web application for industrial monitoring purposes and therefore need to rely on up-to-date data.
Has anyone encountered the same issue? Any help on this is greatly appreciated!
I don't know entity framework that well but I think this has something to do with change tracking. I'd try disabling it to force EF to re-query the DB, I think (and others please can correct me if I'm wrong) but unless SaveChanges has been called on an ObjectContext if you re-query the same data the database won't be queried again.
I've used MergeOption = MergeOption.NoTracking (on the ObjectSet) to turn it off in my project.