2

i have to write small java database application with several tables. With that i have some experience and can do it. That would be on one machine.

From somewhere on net, from other machine it should have to be possible to connect and inspect some database queries in SWING GUI. That network part is with what i do not have experience. What would be best way to accomplish that task? I need some general directions here and maybe some good links with examples to study. Problem is i am kinda short with time here.

From my browsing i saw the most easiest solution is to connect direcly from distant machine directly with JDBC with ip:port way. Like 111.111.111.111:55 But that leaves DB really unsecure.

I've read about sockets, but i dont see how that helps.

Now, i've seen people mention Hibernate and VPN but i thinks that is lot of work. And others mention web servers, but i have absoulutely no idea how that works.

So, what is optimal solution in your oppinion? Ideas, suggestions, guidelines?

Thanks in advance, Martin.

asked Dec 10, 2010 at 21:01

4 Answers 4

2

JDBC drivers may have different arguments for their data source depending on if you use encryption for the connection.

For instance, MySQL allows you to use an SSL connection, and even has a section in its manual for it. Other databases may vary.

Presumably, your application will also have its own username and password to be sent to the remote DB server.

answered Dec 10, 2010 at 21:58
Sign up to request clarification or add additional context in comments.

1 Comment

I read that documentation and i didnt quite get it, but it sounds interesting. "A sample MySQL server CA Certificate is located in the SSL subdirectory of the MySQL source distribution" - didnt found that in source dist. I'll have to look some more into it, maybe some examples. If you know some good sites, please let me know. Thanks.
2

Some level of security will be provided by using a database login and password. If you are short on time then web services, or sockets aren't going to be quick to pick up. Unless you really need the security just use JDBC for now.

answered Dec 10, 2010 at 22:04

1 Comment

I was thinking about JDBC. I'm gonna explore web services a little, see a few tuts...
1

You have several options.

  • RMI this allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine.
  • CORBA Common Object Request Broker Architecture, is a standard architecture for distributed object systems. It allows a distributed, heterogeneous collection of objects to interoperate.
  • Sockets
  • HTTP server. You can use Servlets or some framework like Struts, Spring etc. for the server side and just call the servlet from your client using Apache HttpClient

Since you don't have much time I'd discard RMI and CORBA and focus on Sockets or the http server solution.

Since you wrote that you dont have experience with web applications I'd go with sockets.

With java you can create a server and client very easy using sockets here is a basic example and Here is a very good tutorial that uses Swing.

answered Dec 10, 2010 at 22:05

2 Comments

These sockets looks most friendly. Thanks for the examples!
Enrique, does things get complicated if there is router on server side? Computers are connected with router into local network, and router is connected with cable internet modem. Can sockets work as they do then?
1

You probably want to write a Web service to expose your data instead of letting a user connect directly to the DB over the internet. Ideally that web service is on a physically seperate machine from the database, so that the database is not exposed to internet directly.

Person <--> internet <--> Web Service <--> database

It really depends on what you consider optimal.

Do you have zero concern for security?

if you're exposing a database directly onto the internet, you're going to have to open up ports on firewall/etc and secure your database, and pray you have no other insecure services exposed to the internet.

answered Dec 10, 2010 at 22:05

1 Comment

Security is not big thing here. But it would be good to have some security. Optimal means good ratio of time/work :) Web service... Like JAX-WS. It has a kilometer long documentation. I dont know would i have had time. Maybe i'll look more into it. Thanks.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.