Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Passing sql statements from client to server

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.


  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    42
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: Passing sql statements from client to server

    Quote Originally Posted by Apache View Post
    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
    Last edited by hns1984; January 11th, 2012 at 06:55 PM.

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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?

  4. #4
    Member
    Join Date
    Oct 2011
    Posts
    42
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: Passing sql statements from client to server

    Quote Originally Posted by Apache View Post
    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
    Last edited by hns1984; January 11th, 2012 at 06:56 PM.

Similar Threads

  1. server client upercase
    By Hokorippoi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 27th, 2011, 04:45 PM
  2. TCP/IP java client, c++ server
    By akboyd88 in forum Java Networking
    Replies: 0
    Last Post: March 24th, 2011, 10:46 AM
  3. [Java] Client - server, example
    By Grabar in forum Java Networking
    Replies: 6
    Last Post: January 22nd, 2011, 01:56 PM
  4. client server communication
    By Brt93yoda in forum Java Theory & Questions
    Replies: 4
    Last Post: September 2nd, 2010, 04:49 PM
  5. Client/Server
    By Dillz in forum Paid Java Projects
    Replies: 2
    Last Post: June 2nd, 2010, 05:19 AM

Tags for this Thread