4 Replies - 7365 Views - Last Post: 13 April 2011 - 08:25 PM Rate Topic: -----

#1 benz21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 18-February 11

MySQL Database Socket Connection

Posted 13 April 2011 - 10:36 AM

I am trying to make a video rental store application. I want it to have a client that uses gui and a server which will have the mysql database. The client will connect to the server and based on thier input, contacts the server instructing it to execute the needed sql commands and statements to the database. Then the server returns the results to the client where it will be displayed within the gui to the user. How do you get a client/server connection to work with a mysql database.

Is This A Good Question/Topic? 0
  • +

Replies To: MySQL Database Socket Connection

#2 mi14chal  Icon User is offline

  • D.I.C Head

Reputation: 81
  • View blog
  • Posts: 202
  • Joined: 11-December 10

Re: MySQL Database Socket Connection

Posted 13 April 2011 - 10:55 AM

On this forum you can find thread about how you get a connection with database http://www.dreaminco...bc-odbc-bridge/
Was This Post Helpful? 0
  • +
  • -

#3 benz21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 18-February 11

Re: MySQL Database Socket Connection

Posted 13 April 2011 - 11:02 AM

Thanks. I understand how to connect to a database. But how do you use sockets in correlation to the database?
Was This Post Helpful? 0
  • +
  • -

#4 MrLuke187  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 81
  • View blog
  • Posts: 237
  • Joined: 09-July 10

Re: MySQL Database Socket Connection

Posted 13 April 2011 - 12:34 PM

The Server (which will run on the actual "Server") will have the connection to the (seen from the Server) local MySQL Database (see mi14chal's link). The Client will then use a Socket to connect to the Server.

Sending requests (with a Syntax you'll need to define) from the Client and sending back the results will be done over the In- and OutputStream form the Socket-Connection.

Greetings: Luke
Was This Post Helpful? 0
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8334
  • View blog
  • Posts: 31,858
  • Joined: 06-March 08

Re: MySQL Database Socket Connection

Posted 13 April 2011 - 08:25 PM

Only the Server will be connected to the database. Could be a local database or a remote one accessed by socket connection. And you know how to do that part.

Now you just have to establish a simple Server/Client connection using sockets.
The Client does not have to know (and actually shouldn't know) if the Server:
- has all data in memory (array or ArrayList)
- read data from a text files
- use Oracle, MySql, HSqlDB, ...


If one day you decide to change the way the Server access/store the data, you shouldn't have to make any change to the Client code
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1