Results 1 to 5 of 5
  1. #1
    crisfromnova is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default Which is the best solution for connecting a Java application to a php server

    Hi all,

    I want to create a Java desktop application(i'm still not sure that java is the best option, but i know it better than other programming languages :D) to connect to a server made in php. I want to make requests to php server to give me some dates from its database in .xml format. The problem is how can I do that in the fastest and most secure mode? I know that I can use the URL class and URLConnection to ask to the server the informations i need, but there is an another way? I think that the xml files will be enough big and I also need to parse them for use the informations, so I need for a very fast transfer between my java application and php server?

    Thanks in advance!

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    use URL and URLConnection. Your speed will depend mostly on the network, not on the classes you're using.

    If you want to get fancy, you can open sockets yourself (new Socket()) kind of thing, but then you'll have to parse HTTP stuff on your own, and I doubt it'll make things significantly faster.

  3. #3
    crisfromnova is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Default

    Thank you for your answer, but I have an another ideea :D.

    I want to use a tomcat server for a better security.
    I read something about tomcat, but I have some things I didn't understand.

    In this moment I have the php server and the java application. How can I insert a Tomcat server between them?

    I need to create some servlets to run on tomcat server and interact with the application, but from servlets, how are send to the php server my requests?

    This is a good choice for more security or I make my life harder without any benefits?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,183
    Rep Power
    20

    Default

    Tomcat is simply a web server for Java, in the same way your PHP server is a web server for PHP code. So adding Tomcat in between your Java app and the PHP server achieves nothing. You'll still have to either open a Socket to the PHP server, this time from Tomcat, or use a URL and URLConnection.

  5. #5
    crisfromnova is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

Similar Threads

  1. Connecting to Server Application
    By andre1011 in forum Networking
    Replies: 1
    Last Post: 10-29-2009, 08:29 AM
  2. java application connecting to a server
    By wildheart25c in forum New To Java
    Replies: 2
    Last Post: 09-17-2009, 03:59 AM
  3. connecting a java application to a DB in netbeans
    By kulangotski in forum Advanced Java
    Replies: 4
    Last Post: 03-22-2009, 10:58 AM
  4. application is not running please fine the solution for it.
    By jagadeeshchinni in forum New To Java
    Replies: 4
    Last Post: 09-28-2008, 11:14 AM
  5. Java connecting to sql server 2005
    By pelegk2 in forum JDBC
    Replies: 0
    Last Post: 04-05-2008, 10:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •