I have an SQL database stored in my server, and I want my iOS app to access it. It contains passwords and such, and I need the app to be able to download the contents. What is the best way of doing this? Thanks
Basically you have two options.
Firstly you can directly access your DB via HTTP requests and get the data that you want.
(Not the suggested way.)
Or you can create a Web service which communicates with your DB and acts as a layer between your app and db.You can either get the all data or the ones you want from DB depending on your Web service.
Related
One way communication, from app to db is well apparent. Is there a way that my db also communicate back to app/ middle tier, or multiple instances of middle tier or apps.
Can triggers be used for this purpose in conventional rdbms (sql server/postgres)?
If you have a .NET based application, you can get notification back from SQL Server easily.
SQL Server service broker infrastructure, query notifications enables notification from database back to the application.
You can implement this in 3 ways.
1- Using SqlNotificationRequest class. Example
2- Using SqlDependency. Example
3- Using SqlCacheDependency Example
Could you help me please? I would like to store session in a local database(dbf) file.
I was searching on the internet, but I could not find anything, about how should this be done. You can use an sql server instance to store session with use of aspnet_regsql.exe, however I did not manage to use with a dbf file. Please help.
First of all, we don't normally use Local Db in Production. Instead, you want to consider using real SQL Server.
Second, you do not need to store Session State in database, unless you plan to host in Web Farm or Web Garden environment. To improve the performance, you can store View State inside Session State which then stores in SQL Server, but I don't think it is your intention.
If you plan to host in Web Farm or Web Garden environment, you might want to look at StackExchange.Redis used in Stack Overflow and Azure.
I'm currently creating an SQL database that will eventually be accessed by web applications, both mobile and desktop platforms.
Setting up the SQL database is easy.
What I'm currently having trouble with is how I'm going to allow clients to access to information in the database without having direct access to the database, for security purposes.
For example, let's say I have a list of employees, and I'm creating employee profiles for a mobile application. I would like for the mobile application to be able to use a function such as get(employee_name), which will call the database and retrieve the information about the employee in the form of a JSON.
How would I go about doing this?
To see a very nice solution on using JSON on sql server tables please look at Phil Factors article Consuming JSON Strings in SQL Server at:
https://www.simple-talk.com/sql/t-sql-programming/consuming-json-strings-in-sql-server/
We have an existing SQL database which stores information which is continiously updated through a number of ways.
Now we want to launch a mobile application which uses some of the data stored in the database. However, we do not know how we can connect to this database.
Is this done via API, do some standard solutions exist?
Thank you in advance!
You app, sitting on a mobile platform (lets say a phone) would need to access the database. This will have to be over the internet, and means exposing you database to direct querying over the internet. This is not a good thing: once the database is open, then almost anyone can get to it.
The way I'd do it is put a web-based front end behind which your database can hide. You app sends an HTTP request to your web site. You can include whatever security you can dream up to authenticate that it's your app and not some random vandal. When the web site thinks it's OK, it accesses the database and returns whatever data it needs to. It might return the data as HTML, but JSON is probably better.
I have a web application which provide some information for my customers. I have another version (windows) that exactly work same as web application.
This is because Web connection may lost for some hours and in this time user is going to use the application.
I'm wonder how to sync these SQL Server databases.
Note that web application is using from 3 different cities and all of them have a windows based application too. What should I do?
NoteL windows verision is exactly web application which installed in the Local Web Server in 3 different cities and users have access to them via their LAN.
All updates in data to from/to web/windows would originate from the windows application. But the problem is that the windows app will run when there is no internet connection.
So you will have to use a windows service which will call a webservice for local and remote database updates. The windows can wake up every x mins and update the remote and local databases.
The webservice will have two methods:
GetData(DateTime getRecordsFromThisDate) - Windows service should call this on regular intervals and update the local database.
UploadData(dataRows/collection) - Windows service should call this on regular intervals and update the remote database.
Each record in database will have a timestamp. For local update, get the largest timestamp and send it as parameter to GetData(). The webservice will return the records created after this time.
For upload data, you will have to store the last time when an successful upload operation was run. Get the records(inserted and updated) after this time and send them to UploadData().
Your choices could be the use of a database backup to synchronize (probably pretty slow and impractical). After that you must use ETL. Pick your favorite tool. You could use either sql server CDC or I would recommend Change tracking to identify your changes and load just those. Then use merge to synchronize your changes. Granted these solutions will require you to set up linked servers or use a third party to temporarily hold the dml changes.
http://technet.microsoft.com/en-us/library/bb510625.aspx
http://msdn.microsoft.com/en-us/library/cc305322.aspx
I thought I would add one non microsoft solution http://www.red-gate.com/products/sql-development/sql-data-compare/ its not free but does exactly what you need.