
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
@cocodintech/cordova-plugin-sqlserver
Advanced tools
Access to SQL Server database directly without any service
Cordova Plugin to connect to SQL Server without services
Sometimes we need to access to databse directly without any server as middleware. The purpose of this plugin is to avoid using services to access data directly.
It can be used on Cordova, PhoneGap and Ionic.
This version is compatible with iOS and Android platforms (IOS not tested yet in this fork!!!)
cordova plugins add @cocodintech/cordova-plugin-sqlserver
You can download the plugin and add it to your project as a local plugin
cordova plugin add /path/to/folder
It is also possible to install via repo url directly
cordova plugin add https://github.com/cocodinTech/cordova-plugin-sqlserver.git
After add the plugin just intialize it with database parameters server, instance (could be empty "" ), username, password, database name. For example:
SqlServer.init("192.168.0.120:1433", "SQLEXPRESS", "sa", "01234567", "dinademo", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert(JSON.stringify(error));
});
On success it will return "Plugin initialized"
After that you can test your database connection with
SqlServer.testConnection(function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
On succes in this case it will return "Connection succeeded"
At this moment there is two general purpose methods:
Once the plugin is initialized you can execute a query on SQL Server by doing
SqlServer.executeQuery("select * from test_table where test_code=1", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
You can call a Store Procedure also
SqlServer.executeQuery("exec i_store_test '500048', '1', 'MMMM'", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
In order to execute an INSERT, DELETE or UPDATE just use somethig like
SqlServer.execute("update table_test set field_test=22 where key_test=500048", function(event) {
alert("Update complete : " + JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
If you need subsequent calls to the database in the ios version you will not be able to do the following
SqlServer.executeQuery("select * from test_table where test_code=1", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
SqlServer.executeQuery("exec i_store_test '500048', '1', 'MMMM'", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
You must do this in the following way to avoid EXCE_BAD_ACCESS error on ios platforms
SqlServer.executeQuery("select * from test_table where test_code=1", function(event) {
// On first call completed
SqlServer.executeQuery("exec i_store_test '500048', '1', 'MMMM'", function(event) {
alert(JSON.stringify(event));
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
}, function(error) {
alert("Error : " + JSON.stringify(error));
});
FAQs
Access to SQL Server database directly without any service
The npm package @cocodintech/cordova-plugin-sqlserver receives a total of 9 weekly downloads. As such, @cocodintech/cordova-plugin-sqlserver popularity was classified as not popular.
We found that @cocodintech/cordova-plugin-sqlserver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.