Hello to everyone who is viewing this question.
I am currently running a web-application server, which only does CRUD operation (using MySQL) for android and iOS mobile applications. Current server is written in Java, which is using Spring-MVC, a Spring legacy project.
I saw lots of posts describing Pros and Cons of Spring-MVC and Node.js.
In my case, I dont use Server-Template-Engines because I only do CRUD operations that mobile applications need as I wrote above.
My final question is, is it more efficient to use Node.js in my case?
Also, I happen to be entirely new to Node.js, and I am currently running my Spring-MVC by installing tomcat8 on AWS Linux.
I would like to clarify that Spring is a Framework and NodeJS is a JavaScript runtime. Having said that I can understand why people like to compare both. Sprint implements many features that make Java easier to use and more like NodeJS.
Spring has many libs that hide the fact that it's multi-threaded (using thread pools and the further design pattern). And not worrying about threads is one of the most powerful features for rapid development.
is it more efficient to use Node.js in my case?
I would say no. I can't say that refactoring your application as-is to NodeJS will improve your situation in any impactful way (Unless there are additional requirements).
Also, I happen to be entirely new to Node.js, and I am currently running my Spring-MVC by installing tomcat8 on AWS Linux.
The one real difference between both approaches is the deployment. As you mentioned Sprint needs to be deployed on an already running server (Tomcat or Apache) where NodeJS (HTTP server modules) approach is that the application is the server as well (more like Spring-Boot)
I love NodeJS and will highly recommend it due to its fantastic community (NPM is full of grate modules) but if you like to continue developing in Java I think Spring-Boot is the way to go.
Allows you can take a look at the following Nodejs frameworks to get a better idea of development env:
LoopBack
NestJS
Related
Quick bit of advice if i may. I'm a startup company and developing a new mobile app that i intend to query and update data from a cloud MYSQL database, using a restful webservice and JSON. I am pretty new to this, but ok on the theory.
I originally thought i could use Dropbox to host the database and somehow install a Tomcat server also, to act as the http server, but i cant find anything online that says this is achievable. I've now found a temporary site heliohost.org, which offers free hosting, so i'm looking into that.
Does anyone have advice on a [low cost] longer term production cloud service for MYSQL database? And am i right that a good approach is to create a restful webservice in Eclipse and then somehow deploy that to the Tomcat server in the cloud, so that my app can then issue calls to it via the CN1 available methods.
There is quite a lot out there and much of it is self-promoting their own sites so was after some independent advice please.
Many thanks in advance.
You can't host and access an SQL server over the network from a device as access is remarkably unreliable and insecure. You will need some form of hosting. I used Linode for our online course since they are very affordable (5USD per month) but I've used AWS, Digital Ocean and others. They are all good.
You are correct that you will need to create a webservice, I used tomcat in the past but for the latest course I chose SpingBoot which is easier and more modern.
Using a mobile backend to store and retrieve data is a vast topic to discuss where different tools and services can be leveraged based on your application use cases.
However directly accessing MySQL server from your mobile client wouldn't be a recommended approach both in term of security as well as performance at scale.
Few options you can consider.
Developing the mobile backend with Amazon Mobile Hub where you can find different architectures and services. For example.
Using AWS DynamoDB as a Mobile Backend tightly controlling access permissions with AWS Cognito and DynamoDB Fine Grained Access Control.
Using Cognito Sync as a storage medium to Synchronize data from Mobile App to AWS and then using triggers to share and push data & etc.
Developing a REST API for the mobile backend using AWS Services such as API Gateway, Lambda & DynamoDB(Or Relational Databases like MySQL, Postgres SQL & etc. with RDS)
I'm writing a nodejs npm module that needs a mySQL database to operate.
I would like to write a test module that connects to a "fake" database and do some operations on it.
I already have setup my test database locally in my developing machine, but I would like this tests to work in any machine.
What's the best practice for writing integration tests modules that depends on an operating mySQL database?
Does exists any public service in the net where I can get a temporary mysql user/password where I can do some operations for a limited time/size?
Usually you would set up a continuous integration (CI) system that executes your tests everytime you commit a change to your version control system. The CI system would provide a clean MySQL database your tests will run against. If you use a CI system in the cloud you often can easily configure it to provide the database. E.g. see Travis CI.
If you set up a CI system other developers will still need to run their own MySQL database on their computer if they want to execute the tests. Alternatively, you may use a mock instead of the real database in your tests. For details see: How do you mock MySQL (without an ORM) in Node.js
However, using a mock won't give you sufficient test results since the mock just emulates the database in a simple way. Sometimes the mock may be too simple or just be buggy. So you will need to run at least some of your tests also against the real database. Thus you may choose to run the tests against the real database with your CI system and run the tests against the mock during development.
Not quite fully understanding the question I would suggest Amazon RDS for short lived testing where accessing something over the public internet is required. Amazon web services can get pricey quick if used for any real traffic but still a good option for any proof of concept.
I have a publicly accessed database on RDS that works like a charm from Netbeans. I would like to deploy my Java application on AWS. What is the simplest way to do this? I will only use the application for some very basic tasks, getting used to cloud computing working on a small scale. Is EC2 my best bet and is it possible to upload apps as easily as with the Google App Engine plugin. Can I use the same jdbc driver as I use locally, and can I use JPA against the database? I would rather not use Eclipse for now as I am in a bit of a hurry and need to get this working as soon as possible.
This is a lot of questions for one question, but I'll see if I can help you out.
1. Simplest Way to deploy to AWS
If this application is as simple as you say it is, the most cost effective solution while you're getting used to AWS will be to deploy to a micro instance and take advantage of the free tier. From Amazon:
AWS Free Tier includes 750 hours of Linux and Windows Micro Instances each month for one year. To stay within the Free Tier, use only EC2 Micro instances.
The simplest way to deploy directly from Netbeans is to use the integrated Elastic Beanstalk support. This saves you from having to configure things yourself.
Another option is to launch a Ubuntu AMI and install Tomcat. Create a WAR file from your application and place it where Tomcat can find it. I suggest using the first method.
2. Is EC2 my best bet?
This is a little open ended. For a nice learning experience as you get accustomed to AWS, the free tier for EC2 is a nice platform to learn with. If your application needs to eventually scale, using EBS is a pretty simple way to manage an application. My answer is an opinion because "best bet" depends solely on the requirements of your application, but I say yes.
3. Is it possible to upload apps as easily as with the Google App Engine plugin?
For simple applications I think so. I think it's even easier if you switch to Eclipse and use the toolkit for AWS. Whether Google App Engine or AWS is easier for you will once again depend on personal preference, the application, and your requirements.
4. Can I use the same JDBC driver as I use locally?
If you're using MySQL Connector/J then yes. Read this to understand how it works with RDS.
5. Can I use JPA against the database?
Yes. You'll change the endpoint from localhost to the endpoint of your RDS instance.
6. I would rather not use Eclipse for now...
Another personal preference, but the AWS toolkit for Eclipse is very easy to use and can speed the process up a bit.
I'm attempting to write a Windows Phone 7 application which needs to connect to a remote data source, in this case it's a MySQL database on a Linux server. I'm not able to move this over to MSSQL, nor to build any kind of windows-based solution (like a WCF web service on the server).
Is there a way for me to use my MySQL database from my Windows Phone 7 application? The MySQL assemblies don't seem to work on the phone. If not, what would the best solution for me to use this database from the phone?
You could build your self a service which would send you json or xml. this can easily be built using mono, python, Ruby, php or any technology that you are comfortable with.
You can build it in a restful manner where all you have to do is call urls in a HTTP GET to retreive data which you handle with the services.
and use the HTTP POST to submit changes to your service.
you can then from WP7 make calls to this service and consume the data.
WP7 does not support sockets at the moment. So your best bet is transfering your payloads over HTTP.
As I mentioned before, if you have access to the machines configuration. You could run Mono which isn't too far off of .Net in terms of language and functionality.
further more, from the phone you can use the Rx library to make these calls Async and keep your application responsive.
I am practicing writing an app which use MySQL to manipulating data.
My concern is if my client machine doesn't have have MySQL pre-installed, it's not be able to run my app, is it?. So is there anyway to embed the database server right into the app, or to run the app without the data server. I wonder how all the softwares out there manipulates data. It's not like we need to install some kind of database server before install the app.
MySQL is a client/server database engine, which means that you must install the client and server separately from each, and they communicate over some kind of network protocol.
If you want to deploy a stand-alone application, you are probably better off using a library like SQLite, which gives you as much of the functionality of a SQL database as you are likely to need in such an app, but instead operates on local files and doesn't require installation of a separate server.
You can embed MySQL in your application, see MySQL as an Embedded Database for details.
Your application could work with the remote database, when configuring database connection you should set your DB server IP address(host), port and login credentials. so in order to write application which is dealing with data manipulation, you need to connect to any database instant.
If you are working on client-server application, MySQL database may be accessed either by means of MySQL (this solution may be suitable for internal networks), or through some database-side service, which can provide some API and which can be accessed from client via some application-level protocol (for example, XML-RPC).
If you are working on client application, there are other database solution, which can be used in stand-alone software: SQLite, Derby. As an alternative to database approach, you may consider storing data in XML / YAML format.
I suggest to wrap db layer in you application witch simple interface provided for all operations performed on the database. In this way, you will not have to go into the details of the atomic operations on the database and through unified interface, you can create several different classes which will be responsible for access to different databases in the same way (the same interface). These classes should realize the interface and implement all necessary methods inside (for example ADO). Now your db layer can be visible in all program it the same way. Wrapped class can realize singleton desing pattern and can be used as one instance enywhere in your application. Universal class design (interface) gives you many benefits such as the possibility of substitution on another layer if necessary (switch to a totally different db).