• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to move servlet code and SQL server code to a server.

Eliran Co

Lurker
Oct 19, 2016
5
0
Hi, I have an application which works this way:

1. The user press on a button in the phone (the client).
2. The client sends a message to a servlet which is running on my personale computer.
3. The servlet sends a message to SQL server (which also in my personal conputer).
4 The SQL server sends an answer back to the servlet.
5 The servlet sends the answer forward to the client (the phone) .
and everything is good.

Now, I have a router which creates a little private net in my house, so my phone and my computer are connected to this little net.
It means, I can use this application in a short range (20 meter) from my router.

The question is, what do I need to do now, in order to use this application everywhere - How do I move all the code I have in JAVA (client and servlet) and SQL code in SQLserver to a server.
Thanks,
Eliran.
 
Well your best bet would be to find a public web hosting service (there are many), which can provide the features you require. Sounds like you need Tomcat (or some other servlet container), Apache, and a database. Btw the most commonly available database server is MySQL, so you may want to look into migrating your database to this.
 
Upvote 0
Hi there LV426 Thank you for the answer! Tomcat is exactly what I'm using these days. my servlet is the Tomcat. So the client send to Tomcat and Tomcat forward to SQL server. Then SQL server sends an answer to Tomcat and Tomcat forward to the client.
What you say is that I need to find a public web hosting service and then what..? Can I just do a copy paste of all I did to this hosting server ? What shoul I do d with the servlet code, and what should I do with all the database? Is there any tutorial I can read about this issue?
About MySql..I have so many stored procedures and code in SQL server, so I prefer to stay in Sql Server (for now).
 
Upvote 0
Hi LV426. I'm using Eclipse and Tomcat is running on my computer. Tomcat is the demo server for me but it is running on my computer. Hence, everything works well next to my router. My question is what should I do in order to work in every place. I don't want to be depends on my router. I need it to be on some external server, but I don't know what to do.
 
Upvote 0
Hi LV426, Sorry now I think I understand what you ment before. The Tomcat you were talking about is not the Tomcat in my compute,r but the tomcat in the server. ok.

My application made of 3 parts: Application code (client), servlet (Tomcat), and DB.
So what I did is to create a WAR file by Eclipse (as you wrote before) which packed my servlet code.

All I need to do now is th take this WAR file and my DataBase (with all its functions, stored procedures, ect.) and give it to a web hosting company which has Tomcat and SQL server right?

What shoud I do with the application code? (the client).
should it remain in my phone and only configure it to the IP of the new Tomcat that this company will give me?

Thank you,
Eliran.
 
Upvote 0
Yes, basically you need to replicate what you have running locally, on a public web hosting site.
Once you have this set up, and have been allocated an IP address, then as you say, configure your app to use it.
The application code remains on the user's phone.

The only difficulty I can forsee is finding a web host that provides SQL Server. As you know, this is a Microsoft commercial product, which obviously costs money. Whereas MySQL is an open source database.
 
Upvote 0
Yes. You are right. It was a mistake. I started develop with SQL server, because SQL express was a free version, and I was used to work with Sql Server in my work place. Now I have more than 150 stored procedures and functions. Is there any automatic way to convert SQL server DB to MySql DB?
There is a company which suggested me to purchase 2 accounts:
1 that there will be the tomcat server (tomcat hosting) -In the sever of the Tomcat they have only MySql..as you said...:( , and then a second account will be the sql server (ASP.Net. hosting).
That way the phone will send message to the Tomcat in the first server, then the tomcat wil query the Db in the ASP.net server. I guess I will need to send them a DB_back_up file and the WAR file you mentioned before.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones