DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How to Build a Pokedex React App with a Slash GraphQL Backend
  • Rails 6: Multiple DB Support
  • Jakarta NoSQL 1.0: A Way To Bring Java and NoSQL Together
  • Lifecycle Microservices With GenAI Tools

Trending

  • Streamlining Event Data in Event-Driven Ansible
  • Agentic AI for Automated Application Security and Vulnerability Management
  • How Trustworthy Is Big Data?
  • Doris: Unifying SQL Dialects for a Seamless Data Query Ecosystem
  1. DZone
  2. Data Engineering
  3. Databases
  4. The Good, Bad, and Ugly of Connecting Desktop Apps to a Database

The Good, Bad, and Ugly of Connecting Desktop Apps to a Database

Let's take a look at the good, the bad, and the ugly of connecting desktop apps to a database. Also explore implementation alternatives.

By 
Memi Lavi user avatar
Memi Lavi
·
Updated Oct. 09, 18 · Opinion
Likes (1)
Comment
Save
Tweet
Share
12.5K Views

Join the DZone community and get the full member experience.

Join For Free

I just got off the phone with one of my colleagues, and we had an interesting discussion about a situation we have with one of our clients.

Here is the situation:

Our customer had, for years, a software that was installed as a standalone product. It was a single machine that had the application (.NET WinForms, in this case, but that’s doesn’t really matter) and the database (SQL Server Express. Again, doesn’t matter), all in one pretty box.

Not exactly state of the art, Micro-Service-y, or cloud-y, but it did the job, and did it quite well.

But times change, and after much thought, it was decided that a central DB makes much more sense, and should replace the aging local database. In this case, the new database is going to be an Azure SQL (but, as usual, that’s doesn’t really matter).

And this is where the problem began.

Implementation Alternatives

From the beginning it was clear we have two school of thoughts here:

On one side — the “Pure Database” believers. These developers wanted to simply start using the new database while changing (almost) nothing in the application. From their point of view, the only thing that needs to be changed is the connection string to the database to point to the central one instead of the local one.

Something like this:

Direct Connection from Desktop to DB

The main motivation for this implementation is quite clear — it requires a minimum amount of code modification in order to work. Simply change the connection string and you’re good to go.

On the other side – the “API” school. These fellas said that there has to be a mediator, an API layer, between the desktops and the DB. Something like this:

REST API for DB Access

Now, let’s compare both approaches.

Direct Connection Between the Desktops and the DB

Pros:

  • Easy to develo: As mentioned above, this approach requires minimum changes in the code. Change the connection string and that’s all.

API Layer Between the Desktops and the DB

Pros:

  • DB Abstraction: When the database structure will change (new columns added, columns type changed, etc.), and it will change someday, this change won’t affect the clients immediately. The API can absorb this change and expose the good ole API until the time has come to reflect the changes. This will make the system much more stable.
  • Loose Coupling: This architecture allows non-native clients to connect to the database. Currently, only clients that support direct connection to SQL Server (such as .NET) can use this method. However, future clients, such as Android phones that cannot connect directly to the database, will be blocked from using it. Implementing API allows all the platform that can access REST API (read: all the platforms) to access the data in the database.
  • Security: The database credentials are stored in a secure server stored in a secure data center. In the first approach, the credentials are stored on every desktop, probably in clear text, and every hacker wannabe can get them and gain access to the database.
  • Cost: (This one is relevant only for databases that stored in a public cloud) Using database in the cloud costs money. The more connection you have to the database, the more money you’ll pay. In the first approach, there are a lot of connections. Thousands of them. Each client uses its own connection. And that’s gonna cost. In the second approach, there is only a single connection, which is from the API to the database. The clients themselves do not connect to the database. This will reduce the cost substantially.

Conclusion

So, which one will you pick?

As you can probably guess, my recommendation was to implement the second approach. Using the API layer in the middle, we are able to achieve a stable, flexible, future-proof, secure, and not expensive system. Yes, it will require a little bit more of a coding, but in the long run, it will have a far greater ROI.

My colleague, on the other hand, wanted the “Pure Database” approach because he believed that less work will result in a better ROI in the long term.

What do you think? Which approach would you take?

Database Desktop (word processor) Connection (dance) app API

Published at DZone with permission of Memi Lavi. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How to Build a Pokedex React App with a Slash GraphQL Backend
  • Rails 6: Multiple DB Support
  • Jakarta NoSQL 1.0: A Way To Bring Java and NoSQL Together
  • Lifecycle Microservices With GenAI Tools

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!