Link to home
Start Free TrialLog in
Avatar of Marianne VAN WYK
Marianne VAN WYKFlag for South Africa

asked on

Connecting a angular, ionic project for android to a local SQL server

I am writing a new project in angular and ionic, and coding in Visual Studio Code, using a tutorial from Udemy. In this tutorial, a API is used as an example ( ), for fetching data and displaying it etc. I also use cordova to build for android as this is a app that will be installed on a tablet.

In my project, I want to connect to a locally hosted database (SQL server 2017) that is simply installed on a windows 10 machine at each of our customers. I need basic CRUD operations (like inserting a new client that is captured on the tablet).  From what I have seen, almost everyone recomends writing an API to form the connection. Is this the only way to connect to a locally hosted db? I also came across a cordova plugin  (,  but this does not explain nicely how to implement it, and I was unable to get it to work correctly, when built, a error message "Tab1Page.html:21 ERROR TypeError: Cannot read property 'init' of undefined" is given.

What is the best way to connect to a local db?
Avatar of lcohan
Flag of Canada image

I believe you should be able to do this via JDBC driver as described here OR alternatively the more complex solution of building a web service that could help your app to access the SQL database and there are many libraries, frameworks and platforms that can help you to simply write a web service.

You can find an example using JTDS jar here:
Avatar of Marianne VAN WYK


Thank you for your quick reply.  I am actually using Visual Studio Code to write the app (I have edited the question to include this now as well), and I see this solution via JDBC is implemented into Android studio.  Would this work in vs code?
You should be able to use both JDBC and JTDS in that case - whichever is easier as it's just the connectivity driver between your app and the backend database -
Avatar of Marianne VAN WYK
Marianne VAN WYK
Flag of South Africa image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial