Hyperledger Fabric Rocksdb Database, Retrieve and Modification - database

I am working around to figure out that Fabric v0.6 is really not allowed data modification illegally. Beside I want to modify data in "sst" format directly. I want to use some other such as create instance of database then retrieve all data -> Modified them -> put them back and star the peer normally. but when I try to create instance of Rocksdb, I got this error
Rocksdb Error Column Family Not opened...
Based on this tutorial: http://pyrocksdb.readthedocs.io/en/v0.4/tutorial/index.html
If it's a new database then it's fine. while it come to database of blockchain, I got this few error.

Related

Sequelize returning old data from SQL Server

Problem: what I'm sometimes seeing is that very old data is being returned from my various databases when I do SELECT operations (findAll).
I have a VueJS app in which I'm using AxiosJS to call my backend ExpressJS app which uses Sequelize to connect to several (4) SQL Server databases. I'm also using the VueJS Developer Tools so I can see the variables and Vuex store change in real time on the frontend. I'm also using console.log on the backend so I can see some things there too.
In searching for solutions, I have found that:
I'm not using transactions; all of my queries are single queries that return results to the application, so I don't (shouldn't) have issues with commit timing; i.e. I UPDATE or ADD a row and only after it returns a result do I then make a SELECT
Sequelize keeps connections open, and so old connections show as "Sleeping" in the DB; I see these do get reused over time
I'm using the default isolation level in SQL Server which is READ COMMITTED and which should return committed data; since I'm waiting for the first query to return a result before launching the second query, shouldn't it be committed and ready to get me the latest values?
I see that SQL Server CAN store old copies of rows, sometimes making SNAPSHOTS, but I think they require higher isolation levels - but I'm not sure about that; maybe it IS keeping old versions?
I've been unsuccessful in figuring out how to close and reopen Sequelize connections. I'd like to close things at logout and reconnect there too since the app is still running in the tab (if this will solve my old data problem), thereby allowing someone to relogin and open all of the DB connections to be available again. I can't figure it out based on the available docs.
I think Sequelize is using old connections and somehow it is that which is causing SELECT results to be stale - this is even more likely if SQL Server is keeping old versions of rows
For some reason, if I logout and do a hard refresh of my app (CTRL+F5), all data is fresh; I don't understand why this would be at all. What could the browser be holding on to? Note that the console logs on the server app are always consistent with whatever the frontend shows. In other words, if the backend console log is stale, the frontend is stale; if backend is fresh, frontend is too.
I am unable to duplicate the getting of stale data using SSMS or Postman
Question: So what are the possible ways I can be getting stale data when I'm using Axios on the frontend and Sequelize on the backend?

Use .json file or database for static data?

I am building a web app using nodeJS with an angular based frontend and a Firebase/AngularFire2 backend. I have a list of about 80 cities and couple of details about each of them that I need to display with checkboxes for the user.
Should I save them as a json object in a .json file on the server and call it, or just store it in my Real-time Database and query it? Are there any speed/memory benefits to either?
There are two scenarios :
1.Your task is search oriented. You have to query the data and manipulate it. Memory management is key issues for you. You want some complex searching methods on your data. Then go for the database.
2.Your task require whole data at a time. You don't need to worry about memory management. Then directly load the data from file. Obviously this method will save the connection making time with your database. It will work as simple as file streams. [suggested for your case]

How sql source (RODBC) connects with Shiny?

My question is when or in what instances gets the shiny app refreshed once a SQL RODBC connection is established (or alternatively also other types of connection like RJDBC etc.)?
I connected shiny app to a database using RODBC package:
library(RODBC)
connection <- odbcConnect(dsn, uid = "", pwd = "")
Subsequently I create an object inside R to manipulate further the data:
object<-sqlQuery(connection, "SELECT ALL * FROM <the table>;")
I keep the app running online so others can see the data visualisation. Is the shiny app refreshed from the SQL source every time someone opens the app in the browser or refreshes the browser page?
Or is it a bit more complex and I need to build in an observer in the data input pathway when reading data in from SQL server?
(Note: the SQL source is updated weekly, therefore, I cannot test this at the moment.)
I can only guess based on the code extract, but as I see it your code will never update based on reactivity. I don't see any reactivity in your code, which will automatically update the contents of object. However, it depends where your code is. If your code is inside the server object it should refresh for each session (this is user/refresh/...). However, if something reactive changes like a pressed button it will not update automatically
However you should be able to try it easily
object<-{cat("test");sqlQuery(connection, "SELECT ALL * FROM <the table>;")}

Load data when webservices starts

i have a scenario where i have to load data from SQL server when i start running a web service. Later i have to use this data for my application, instead of accessing it every time from Database. In addition to this this data should be refreshed every one hour without affecting the website operation on the back end.If any of you has came across such scenario please let me know the solution. By the way i am using asp.net web services, SQL server database, and DNN for my front end.Thanks in advance.
In Global Asax,Application start event you can load all your data in the Dataset.
And by using Sql Cache dependency, You can refresh the data for each hour.But loading the
Entire data is not advisable.By making so you memory will be full.There will
be Performance degrade.
http://www.codeproject.com/Articles/14976/ASP-NET-Caching-Dependencies
Pre-loading all of your data is not a good practice because the database loses its purpose then. It’s probably ok for some data that is very rarely updated but needed very frequently but most definitely not for all the data you have in database.
As for the loading of data you can use app start event as others have already suggested.
Regarding caching – use Application object to make this data available to all parts of application and add a proprety to it that will keep the time of the last update. Then just create separate service that will check the last update time every X minutes and refresh the data when the time comes.

Web application database load reduction

I am using a combination of JSF,Servlets and Beans for a web application.The thing is I hit the database for some data and this data is populated on the user page in a chart manner using JFree chart.But the problem is,I dont want to hit the database each time,one query is enough to get all the data.So I want a logic which hits the database only once and gathers the data perhaps in a bean and then populates it according to the user request.Can this be done in my same application,should I be using Java Script to do this.I have the logic to populate the data but I dont have any idea where to put the Data Access Object method so that it executes only once.
You can use Spring cache-abstraction, and cache the data using EHcache

Resources