Not able to save records into db after published to shiny server - r

I have published one application on shiny server which basically takes input from users and save into SQLite database in back-end.
My concern is after publishing to shiny server when user is opening the form and saving their input i can't see any record saving in database.However it is working perfectly fine when i try to launch from R-studio without publishing.
I have put database file into shiny folder before publishing,i believe issue might due to the path of the database so is their any specific folder or path on which we suppose to put our database file?
Any help would be appreciated!

Are you sure that shinyapps.io supports write access for sqlite? There is a community post (see https://community.rstudio.com/t/shinyapps-io-and-sqlite-as-persistent-local-data-storage/19361). From this it is clear that shinyapps.io did not support local data storage at that time and there were no concrete plans to implement it. That was one and a half years ago, true, but it may simply be that it is still not be available at this point. That would mean that you can most likely read but not write sqlite.
Hopefully, you find an alternative to store data here: https://shiny.rstudio.com/articles/share-data.html

Related

Possibility of getting offline shinyApp without Publish Button, csv Data and seeing R code?

Hi guys i have made a shinyApp for a client using R.
The client for whom I’m working is asking for a shinyapp that works offline preferably in the form of an application or shiny window (as the online link of shinyapp.io will put load on the server). He wants to get the shiny output without seeing the R code.
He will later handover the shinyApp to his employees (>200) and they will mostly use the offline shinyApp on their desktop (in shiny window). Furthermore the data is very confidential so the client doesn't want his employees to either get csv data or publish the app online or see R code. Because every time they would run the app, they require csv data or codes to generate output.
That's why he doesn’t want a publish button anywhere in the app so that his employees doesn’t publish the app online.
Is there any way to do so? Any suggestions would be much appreciated
Method 1
I feel this is the best way to do it. This will give you an exe setup to install on your clients' server If you find it complicated you can try the below method, but my first preference would be this one.
Method 2
The process of making your standalone app is best explained here.
You can also use this site. If you feel the first is a little ambiguous
It is very much possible, and I do it often. If you have any doubts, you can ask me. This will not show the code to your client, it will be like any other desktop/server app, although the code can be seen if the app is probed, unlike the first method.
You can put the packaged app in a server which serves the local IPs.
I think you can do it without any hassle. Just follow the instructions line by line.
Regards/Revanth Nemani

ADODB recordset error "Operation is not allowed when the object is open" (3705)

I have a legacy ASP application that I support. By support I mean that I haven't touched it since about 2005 because its just worked.
However there were a couple of data issues in the Access database that the ASP application uses. So like a fool I opened the database directly over a fileshare (using MS Access 2007), fixed the data and saved it down (in Access 2000 format).
Now the application will retrieve and display the data OK, but any updates fail with the error 3705: Operation is not allowed when the object is open. I have not changed the code in any way, the only change was the data update and database save.
I've found plenty of examples of this error, but they all relate to fairly simple issues like ensuring the recordset is closed before opening it, changing the CursorLocation enum, etc. I've tried most of these in the vain hope that something will work, but nothing has.
Any ideas how can I fix this?
Thanks.
UPDATE
I've installed a web based access database management system, and have tried to compact and repair the database. I received the error:
The Microsoft Jet database engine cannot open the file '<snip>'. It is
already opened exclusively by another user, or you need permission to view
its data. (-2147217911)
I have run the macro detailed here to determine who is logged onto the database, and just showed the admin user (which was me - while running it)
Those errors mean one thing: the database file is opened by some other process and thus is being locked.
Most likely that "web based access database management system" is the culprit, try to find how you can configure it to not lock the file, or get rid of it.
As a work around or way to verify the real problem, you can copy the .mdb file into different location and change the classic ASP connection string to check if you can update the database in its new location.
#Remou's comment above about checking the file and folder permissions was correct.
I had our server admin check the permissions, and it seems that the write access had dropped off the folder (and the files also inherit their permissions from the folder). He said that this has happened before when saving directly over the fileshare.
(accepting in lieu of an answer from #Remou)

how to use pre-populated database with tidesdk/titanium desktop

I'm in need of some help in developing a desktop application with a pre-populated database. I have tried numerous ways to get this working including those mentioned on both Tidesdk's API here http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Database.DB and at Titanium Desktops old API here http://developer.appcelerator.com/apidoc/desktop/latest/Titanium.Database-module.
While the later (using Titanium not Ti) works in creating a database in the apps directory it does not install my pre-populated sqlite database which is located in the resources file of my app.
A couple of my attempts located below
var db = Titanium.Database.openFile('test_db.sqlite', 'test_db');
var db = Titanium.Database.openFile(Ti.Filesystem.getFile(
Ti.Filesystem.getApplicationDataDirectory(), 'test_db.sqlite'));
var db = Ti.Database.open('test_db');
As stated most of these manage to create a database with the name given but when trying to run something as simple as a db.execute(SELECT) of something I know would exist in my pre-populated db I receive an error stating
Exception executing: SELECT name, id FROM people ORDER BY name COLLATE NOCASE, Error was: SQL Statement invalid or database missing
I have searched high and low for something to answer this but everyone continues to refer to the aforementioned API's or to the Mobile API's Ti.database.install() which does not work either.
Is it possible with titanium desktop to use a pre-populated sqlite database or do I have to populate it after I create it? If so any direction would be helpful (where to place the .sqlite file in the app and what functions to call).
I am currently using Titanium Studio with a titanium desktop osx SDK of 1.2.0.RC4 as requested by tidesdk.org until they have released there open source sdk.
Thanks in advance
This is possible, I just used this feature in a recent desktop app, deployed it successfully to Windows and Mac.
In my experience, sometimes your database file can be corrupted, for example if you use the Titanium.Database.install command, and it cant find the file to preload from (maybe the first time you specified the path wrong for instance), it will create the file itself, any subsequent install commands will not work because it already thinks this database has been installed.
Have you tried clearing out the application data? This is where titanium installs the database. For Mac this is in your /User/Library/Application Support/APPNAME directory. Their is a directory for databases, delete this and try again.
Also, this answer on Titanium Q&A may help, it talks about the process with the Mobile SDK but the Database stuff is the same.
Hope this helps!

How enable iCloud support for sqlite?

I want to provide iCloud support for my wrapper around sqlite. Is not using coredata.
I wonder how enable iCloud for it. The database content is changed all the time (is for invoicing). Also, if is possible to have some kind of versioning will be great.
Exist any sample I can use to do this?
The short answer is no, you would need to use Core Data as you suspected. Apple has stated that sqlite is unsupported.
Edit: Check out the section on iCloud that's now in the iOS Application Programming Guide under Using iCloud in Conjunction with Databases
Using iCloud with a SQLite database is possible only if your app uses
Core Data to manage that database. Accessing live database files in
iCloud using the SQLite interfaces is not supported and will likely
corrupt your database. However, you can create a Core Data store based
on SQLite as long as you follow a few extra steps when setting up your
Core Data structures. You can also continue to use other types of Core
Data stores—that is, stores not based on SQLite—without any special
modifications.
You can't just put the SQLite database in the iCloud container, because it might get corrupted. (As you modify an SQLite DB, temporary files are created and renamed, so if the sync process starts copying those files, you'll get a corrupt database.)
If you don't want to move to Core Data, you can do what Core Data does: store your database in your document folder, and store a transaction log in the iCould container. Every time you change the database, you add those changes to a log file, so you can play them back and make equivalent changes on other devices.
This gets pretty complicated: aside from getting the log/reply logic right, you'll want to coalesce redundant changes and periodically collapse the log into a complete copy of the database.
You might have an easier time developing a solution if you can exploit knowledge of your application (Core Data has to solve the problem in the general case). For example, you could save invoices as separate files in the cloud container (text, Property List, XML, JSON, whatever), writing them out as the database changes and only importing ones if the system tells you they were created or changed.
In summary, your choice is either to migrate to Core Data or write a sync solution yourself. Which one is best depends on the particulars of your application.

Copy of Access mdb database being updated by live database

I'm trying to compute statistics for data held in an Access .mdb database. In order to avoid interfering with the live database, I'm working from a copy which I made by simply using copy-paste in Windows Explorer. The copy resides in the same directory, but with a different name.
I'm using R and RODBC to connect to the copy of the file. The strange thing is that new data that is being updated on the original live database is appearing in my queries. This is despite the file timestamps of the copy not changing at all. It is also causing some slowdown in the live database.
My understanding is that the .mdb files are standalone, or is this not the case? Should I have copied the database in a different way?
It seems that you may have copied the front-end of a front-end / back-end set up. The back-end is where data is held and tables are linked to a front-end to hold forms etc. Copying a front-end copies the back-end links, so the data is live.

Resources