Marianne VAN WYK
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 ( newsapi.org ), 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 (https://github.com/SergioDosSantos/cordova-plugin-sqlserver), 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?
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 (https://github.com/SergioDosSantos/cordova-plugin-sqlserver), 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?
ASKER
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 - https://social.msdn.microsoft.com/Forums/en-US/36e7b9cf-5bc5-445d-874c-1d6f8e819b63/ms-jdbc-driver-performance-observations-versus-jtds?forum=sqldataaccess
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can find an example using JTDS jar here: https://parallelcodes.com/connect-android-to-ms-sql-database-2/