Setting up MySQL and Apache for RESTful webservices - java

Can anybody point me in the right direction for instructions on setting up the following items on a Windows development PC?
Setup a MySQL database.
Setup an Apache webserver, a framework plus an IDE so that I can write RESTful APIs using Java and JSON.
I am using this to write a native Android and IOS mobile app that will store and retrieve data from the MySql database using the RESTful APIs on the Apache web server.
I have searched through several tech books, Google and Stack Overflow but cannot find anything that contains the above specific items. Within Stack Overflow, the following two links proved useful but do not give the specific items that I need. Android - Ruby on Rails - MySQL AND Best practice selecting database for mobile app

If you are planning to develop RESTful APIs using a Windows development PC, you could consider some of the available software bundles like XAMPP (https://www.apachefriends.org/index.html), which include an Apache distribution containing MariaDB (successor of MySQL, you can work with MariaDB as you would in MySQL), PHP (server-side language), and Perl (not neccesary) in a single Windows installer. Then, once you install it, you will have a complete web development environment up and running.
Then, considering that you develop your APIs using PHP as the server-side programming language (which I strongly recommend you as it is the most widely used language for this purpose), several additional decisions have to be taken, in terms of deciding about:
The IDE to develop in. When working with PHP, I recommend you PHPStorm IDE (https://www.jetbrains.com/phpstorm). The best in my humble opinion. However, quite complex and not very easy, but it completely worths learning.
The PHP framework. Unless you want to manually program your APIs (completely madness), you will have to use one of the many available PHP frameworks. In this case, I recommend you Laravel Framework (http://laravel.com). As far I have seen and worked, the best present and future option concerning PHP development. You could then install some RESTful API specific package in top of Laravel to speed up the development, like Dingo/API (https://github.com/dingo/api).
I insist this is just my recommendation, but you have to know that behind all that languages and frameworks there is a quite long and hard learning curve.
Good luck anyway!

1) To install MySQL on Windows refer to this official MySQL guide.
You will need to download and then extract the zip file (I would recommend the Community Edition). You will have all the details you need in the link above. Note that the .msi installer for Windows is no longer available for newer versions of MySQL.
2) Since you are going to use Java, you do not need the Apache web server (httpd) but you need Apache Tomcat as a servlet container (or other alternatives like Glassfish, JBoss as full Java EE application servers).
For building RESTful Web APIs in Java, Jersey is very good option (https://jersey.java.net).
Finally, as an IDE you can use anything, the most popular being Eclipse, NetBeans and IntelliJ IDEA.

Related

Is there a Java framework/assembly similar to the .NET Microsoft Enterprise Library?

I'm looking for a Java assembly similar to the Enterprise Library assembly that Microsoft wrote, which includes a Cryptography, Database, Logging, Security, Validation and other application blocks that wrap around the .NET framework. It's main purpose is to improve performance and to provide an API that makes it easier to build applications, so the application developer doesn't have to re-invent the wheel on the core libraries for doing common tasks. I'm primarily looking for a nice assembly for connecting to Oracle and SQL Server (for databases), as well as the other application blocks that I mentioned above. I am going to be building a bunch of reporting tools using a Java back-end and would like a jump start.
For Oracle and SQL Server, look for the JDBC drivers for each one (SQL Server here and Oracle here).
For cryptography, Java already comes with it bundled in, click here for docs.
For logging, there are many libraries:
Log4j
Logback
Java logging API
Security and validations are dependent on what kind of application you are using and there are many options other than the ones provided by Oracle itself, you need to provide more information what kind of app you are going to build so that people can provide better answers.
Also, most of the tools people use in the community are not provided by Oracle (this is a main difference between the Java and .Net ecosystem) so, you will find that there are many solutions on open source projects for the same problems and you will have to think, try and decide wich one of them to use.
I think you're describing Java EE. See:
http://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition
http://www.oracle.com/technetwork/java/javaee/overview/index.html

Java Wireless module development

I am by no means a Java expert (not really intermediate either) but i can write enough to get me by. At work we are looking a Cinterion TC65 wireless module which runs embedded Java with a 2G sim card for network connections. I have never done Java mobile dev so the whole startApp(), pauseApp(), destryApp() is throwing me slightly. What i need to know is if its possible to include normal Java code, ie. Mysql Connections, HTTP connections? Or does it all have to be done over AT commands? I need some Java buffs to help me out on this one :) Thanks
Currently there are various UI framework available for J2ME app development
lcdui
lwuit
kuix
If you want simple UI then go for lcdui , It also comes with Netbeans designer so you don;t need to much worry about designing form and flow of application.
You can't have mysql connection directly from j2me application, for that you need to port your webservices accessing your DB and you can call your webservices. you can also make URLConnections.
The TC65 and later modules such as TC65i, BGS5, EHS6, ELS61-E all run Java ME 3.2 so you can write normal Java. But you do have to write with a reduced J2ME 3.2 feature set, you cannot use newer features of Java 7 or 8 for example.
The two development environments you can use are Eclipse Juno and Netbeans 7. These come supplied on an installation "CDROM" download.
These two links show how to get started with either Eclipse or Netbeans on a current module such as BGS5 or EHS6. The simple tutorial re-uses an beginner's example from a Java text book:
Eclipse - https://developer.gemalto.com/tutorial/starting-out-java-me-volcano-robot-project-eclipse-juno
Netbeans - https://developer.gemalto.com/tutorial/starting-out-java-me-volcano-robot-project-netbeans-72
There are further examples of using HTTP connections on the developer website:
String connProfile = "bearer_type=gprs;access_point=internet;username=;password=";
http = (HttpConnection) Connector.open(url + ";" + connProfile);
You can also use the module's Internet Services via AT Commands, but there is no need as most functions have Java APIs associated with them.

Creating web service app for enterprise Java vs C++?

So we want to develop a service app (web Service with post/get API). What is language to go for secure, fast, enterprise app for about 2000 employers to use with about 20~40 services for interacting with DB server (which in my case will be Oracle) Dev time a year Dev team of 3. All capable of righting C++ code as well as Java (so they will now them equally bad at the beginning of process)
Definitely java! You might want to check the jee6 tutorial on JAX-WS to get an idea of how web services are created using enterprise java (http://download.oracle.com/javaee/6/tutorial/doc/bnayn.html)
This will also guide you on how to do it using the netbeans IDE (http://netbeans.org/kb/docs/websvc/jax-ws.html)
Cheers!
You'd be masochistic to try this with C++! Definitely Java, J2EE whatever (look at various technologies from groups such as JBoss). The development process will be significantly faster using these existing technologies than writing your own...
The question is not what language to choose but which "architecture" or paradigm.
If you want/need to use SOAP then C++ might be fine, go and google for "gsoap". However I would recomend Java and REST as architecture paradigm, well we would need to know more what you really want to do. Perhaps some RMI or CORBA would be much easier. If you want to play with Java, Groovy or Scala (all languages run on the Java JVM), then google for "restlet".
Best Regards
Angelo
I would suggest using the Java / Netbeans combination.
Netbeans has a number of tools which makes web service development easy.
Good overview here.
Netbeans allows full use of JAX WS and Metro and is integrated with Glassfish and Tomcat servers (part of Netbeans download) so you can get up to speed really quickly.
you can use either C++ or Java depending what you're implementing. To see an example on C++ check out this great post by IBM Engineers: http://www.ibm.com/developerworks/webservices/library/ws-xml-rpc/

python vs java on web service development?

i am currently using php as backend language in webdevelopment. but im wondering what you need to install to get running with python and java.
with php i need apache and mysql.
can i use those for java and python too?
i cant find good guides equivalent to LAMP/MAMP/WAMP so i understand the parts when using either java or python. would be great if you could give me some good links on the installation and what is required.
and i have read that its easier with python. but is this the only advantage of using python instead of java. cause with java i can create java applets, desktop and mobile applications. they all tend to have java installed. but not python.
so why should i use python instead of java.
I can only give suggestions for web development in python:
Use Tornado - A non blocking web server.
Use Jinja2 - A templating engine.
Use MongoDB - A schema less database server | You can also use any RDBMS according to your requirement.
Above 3 tools are enough to build a web application in python.
or you can always choose Django - The giant web framework with all the features required to build a scalable web application in python.
You need to look into the Web Application Framework subject. Some SO pointers:
simple-webserver-or-web-testing-framework
web-application-frameworks-c-vs-python
django-vs-other-python-web-frameworks
what-web-application-framework-for-java-is-recommended
can-anyone-recommend-a-simple-java-web-app-framework
...
Good luck.
web2py is a python web framework that is completely self-contained, runs portably off a USB drive even. The manual is available on scribd, and after an hour or two of tutorial you will have a pretty good idea of what a python web framework will be like. I can't comment on Java at all.
EDIT: Django and web2py are very, very similar. I think I prefer web2py because it does more for me that I don't have to do, but from the POV of, say, Java frameworks, Django and web2py may as well be the same thing.

How to take a Java Web-application offline?

We develop Java Web-aps (Websphere, DB2) which display graphical and databased information. We would also like to offer the same application offline (distribution via CD/DVD) with online data-update. We have tried a number of alternatives in the past, but nothing has been really stable. What are the new best practices to take a Web ap plus data (in a small database) offline?
I don't know how well it works with the CD/DVD distribution front, but the first thing that comes to mind is Gears. On the .NET side of the fence there's Silverlight 2. Then there's the Mozilla Prism project, although I don't know how far advanced that is.
These are all designed for not just offline access, but mixed offline/online, talking to a server when it's available and working locally when necessary.
I'd suggest using Apache Derby as the database (also available as Sun's Java DB, and possibly still IBM Cloudscape (does that still have DB2 compatibility in place?)).
I'm sure there's plenty of Web servers/Servlet containers about. Apache Tomcat is the obvious one. An alternative approach would be to use an embedded native browser within a single Java process. That approach should be relatively hassle free for users and tech support, and you can just use WebStart to install and update.
If you're using EJBs and other nonsense, then there are similar freebies about. I understand Sun Glassfish is nice and fast starting.
You could create an image of your server as a VMware instance and distribute it with a copy of VMware player (licensing allowing of course). Personally I'd build it on top of a Linux distribution like CentOS5.
You can bundle a JRE along with JETTY server and use a different database e.g HSQLDB (that you can bundle inside the webapp itself).
If you are using an ORM tool to connect to database, you might not have to make many code changes for this.
A lot of Application server distribute their admin consoles like this.For e.g Weblogic admin console runs offline (it uses internal ldap server for its database)
Also as far as Google gears is concerned, they are also pretty much doing the same thing.
They have a server that is bundled along with SQLDB and they allow to synchronize the data between online offline app.
You can sync the data too (use webservices in the online app) and talk over https from the offline app to sync the data, if you need the sync feature.
Also you can check this link
http://developers.sun.com/learning/javaoneonline/2007/pdf/TS-69700.pdf

Categories