I am currently working on an electronic gradebook that among other things allows the user to store students and grades in a Java desktop application. I want to be able to send that information over the Internet through a stream to a Ruby on Rails SQLite3 database. The purpose is so that students can access reports relating to their grades from the Ruby on Rails application. I’m hoping to make the connection as simple as possible. Both the Java and Rails applications are mostly complete (although Rails SQLite3 database needs to be normalized). The problem is that I don’t have experience connecting applications and I cannot find any information relating how specifically to connect a Java desktop application to a Ruby on Rails SQLite3 database. If I was able to find a single example or book that dealt with this specifically then that would be something to work with. So far my understanding, which is just too general for me to do anything with, is that I should probably use REST API and JSON or JRuby. My Rails application is already mostly created, so I really want to stick with standard Rails. If anyone was able to refer me to a working example or offer any insight I would be grateful.
Asked
Active
Viewed 352 times
1 Answers
1
Your Java app should make http requests to the Rails app. On the Rails side, you handle it the same as any other kind of request. If you need to retrieve data from the Rails app, then the relevant Rails actions would need to return the data in a format your Java app can understand, and nearly every language has libraries already written to parse JSON.
-
Since the web application CURRENTLY is not attached to a server but instead being run on a virtual machine is it possible to make an http request that, for demonstration/testing purposes, can connect from a Java to a Rails application that is on the same computer? The idea is that hopefully I could test and demonstrate with both the on my own computer then eventually use the same http request or a modification of it to connect to a server (when I eventually deploy the web-based application to the server). – Daron Oct 11 '14 at 14:24
-
Sorry for not accepting your answer right away. It really helped me in moving forward. I was completely new to StackOverflow. So I went back and checked you. – Daron Oct 13 '14 at 17:30