Passing sql statements from client to server
Hi Guys
I'm developing a little app that has a client and a server. Very simple contacts program.
I can update, delete, insert into my database if everything is on the same computer, but I want to implement client / server (don't ask me why, just for the hell of it!).
So the database will sit on the server and the client will send sql statements to the server, the server will then execute them and pass the response back to the client.
Has anyone done this before? Can anyone point me in the right direction?
Thanks.
Re: Passing sql statements from client to server
Quote:
Originally Posted by
Apache
Hi Guys
I'm developing a little app that has a client and a server. Very simple contacts program.
I can update, delete, insert into my database if everything is on the same computer, but I want to implement client / server (don't ask me why, just for the hell of it!).
So the database will sit on the server and the client will send sql statements to the server, the server will then execute them and pass the response back to the client.
Has anyone done this before? Can anyone point me in the right direction?
Thanks.
Well, I am afraid that no one ever done that before. Sending SQL statements through network is a bad practice. Consider to build SQL queries on the server, the client only send required parameters and receive result.
java exception
Re: Passing sql statements from client to server
Cool thanks. So use PreparedStatements and then just populate them with passed parameters from client?
Would you have an example?
Re: Passing sql statements from client to server
Quote:
Originally Posted by
Apache
Cool thanks. So use PreparedStatements and then just populate them with passed parameters from client?
Would you have an example?
Yes, you're in the right way to use PreparedStatement. Sorry I don't have any examples in my hand, but this may help you: Using Prepared Statements (The Java™ Tutorials > JDBC(TM) Database Access > JDBC Basics)
java exception