1

So right now I have a working application created using swing and Mysql Database through JDBC. So the way I see the client-server setup is that Ill put the .exe-wrapped swing project to reside on PC1(server pc). Then it may have 2 or more client pc's PC2(client) and PC3(client) where all these 3 PC's are connected via LAN.

What should I do to embed the MySql database that my swing application is using so that if I wrap the java swing project to .exe, the database will be embedded together with the exe/installer? What's the best tool to use given the specifications?

If first question is possible and let's assume that the swing app and mysql database are wrapped together and is residing on PC1(server pc), what do i do next so that the copy of swing application on PC2(client) and PC3(client) can talk to PC1 (server)?

Can I accomplish the client-server setup I want without any network or socket programming? (my professors who are non-java programmers said that on other programming languages such as C# that you only need the IP address which im clueless about).

Problems: My knowledge is limited to JDBC, Java Swing and Mysql. Tools are Netbeans, mysql j connector, mysql workbench, xampp.

I only have 6-7 months left to do it so if socket or network programming is required to be learned, i will study it from 0% knowledge on it. I fear that time may not be enough if it's complicated.

I have read things about RMI which i don't know. Dont know if it has something to do with my problem.

This question may be lengthy but I can't think of a shorter way to explain it because i guess client-server setup is broad in Java as it applies on other webservice.

I'd appreciate any suggestion or explanation but I'd prefer a detailed one since my knowledge is limited.

Thanks in advance.

To add, I read somewhere that maybe all i need is to use the Java Web Service with Swing application. Any thoughts or suggestions?

9
  • You don't know what to research until you know what the interface is with these external systems. Ask questions to know, you can't solve it with code until you do. Commented Jul 1, 2016 at 10:53
  • While I think in some respects this is a good question, I also think that it's a bit too broad for StackOverflow, but hopefully someone will be able to point you to some tutorials or guides for this topic. Perhaps you will have a positive response from this topic Commented Jul 1, 2016 at 11:00
  • @Gimby Thanks. Actually the client doesn't have many computers. In my estimate, there's just about 5 computers to use the system we are developing. So they're probably going to use just an ordinary switch or router. I just need to know how to do it in Java. I'd appreciate any suggestion. Is there a specific package to use? Thanks again. Commented Jul 1, 2016 at 11:12
  • @Martin Thanks for the link. Commented Jul 1, 2016 at 11:12
  • It sounds like the client want a client - server application. Unless you need to develop some serious application protocol, there is no real need to get involved with sockets directly. The various libraries will take care of that. nevertheless, your question is very broad, therefore I'm voting to close it down. Commented Jul 1, 2016 at 11:43

2 Answers 2

1

You could:

  • choose an embedded database such apache derby
  • write API to implement database interaction (check derby examples) in form of java project in your IDE
  • write RMI API (check RMI tutorial) to implement server logic based on previous layer in form of java project with a dependency on previous project
  • write your swing client making use of RMI client API.

Then you can:

  • deploy your client/server application with 2 zip archive each containing a .bat script and the jar files for you code and libraries, one zip for server and one for client, you only need jdk installed on PCs.
  • your client main class take server ip address as argument.
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer. I have tried Derby before but had difficulties with availability of examples from their website so right now I may need to stick with mysql since it's almost done. Can I still stick with MySQL as RDBMS and wrap it together with the java project. I also have a question though, do you have any idea on how to create an installer once my project is finished? Thanks.
IzPack seems to be a powerful tool for packaging Java applications, there is also a GUI.
0

One way I can think if it helps, as this is a swing application you can make it as an applet and use a simple app server like tomcat to deploy it. There are tons of tutorials on it like this one.

Now coming to the database side, you can install mysql on one of the machine(PC1) by packaging as zip file and your applet can connect to it from any machine. You don't have to install database in all the machine as you just need the IP of the machine its installed, DB Name, Schema, userid, Password for your JDBC connection.

This way I believe you can make your existing application to a Client-server application. Hope this helps.

1 Comment

@Isiva Thanks for your answer. Though I haven't tried working with applet but mainly on Swing, this looks to be an option. However, I may need to create an installer in .exe form. Is there any way I can convert the swing project to an applet (I don't there is but just asking).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.