![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
Client-Server application
I have this idea in my head of a software program in vc++.net that connects to an SQL database and processes certain transaction.
I would like to ask you guys if my approach towards the following "idea" is the way is it done in the real world or is there alternative ways about it.. So there are several computers connected in a network one of which is a server which contains a database with information inside. all the rest are simple applications that would request information from the server in order to process them (buy.. sell.. whatever). My idea is that, when each client program whats to read/write data to the database located at in the server, Clients and server would have agreed upon codes for each transaction. so the client send 200-John .. which could mean find the adress of all people in the database with name john. this would be done say using Winsock library, and the server would ofcourse set-up its socket and can listen to many incoming connections at once. once the server recieves 200-john. the server connects to its database and finds the result and sends it back to the appropriate client say 500-airport_road.. is this how it is done in real life.. or is there some method where each client can directly hook up to the SQL database without this "server" that comes in-between the client and the database. Thanks Y'all |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
This is a valid approach. However, if all you are wanting to do is to query the database.... you could establish a database connection from within the "client" side, nest your sql command along side it and parse the results from the executed command. This way there would be no need to send special encoded key-value transactions to and from the server. That method would only be beneficial if you were doing other things in addition to querying the DB, like writing files to the server, pulling updates, etc.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Feb 2005
Location: PA, USA
Posts: 254
Rep Power: 4
![]() |
If it were me...
I'd say lose the winsock and get web services kicking since you're in .NET anyways also i'd form a data layer which simply calls a stored procedure or makes a query to your database, stores the results in an object and returns that object through webservices to your client side.
__________________
I have never let my schooling interfere with my education. -Mark Twain- Xbox live gamertag: melbolt |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
Thanks for the feedback guys..
IR.. I belive your suggestion would best suit my purpose, as this project would be the first of its kind and somewhat "the next level" for me... ill start with a simple SQL commands based application, so it would be easier to nest the SQL commands in the data im sending. As for Melbot's reply, sounds like an interesting perspective.. Im still in the process of learning about the .NEt framework and will reach web services in a few chapters and i will definitely look into how your alternative works.. Thanks again. |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Webservices, such as SOAP is probably an excellent idea here in my opinion. Problem with having a client connect directly though is permissions, this can be a bit more insecure than using a Client/Service approach, additionally that you need to aquire licenses to connect to the database (or publish client code to use mySQL) while if you don't release the server publically, you don't have to publish the code for it.
Using a client connection to the database tends to have many drawbacks, espcially for what it seems he is trying to do.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|