Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6367427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:32:46+00:00 2026-05-25T00:32:46+00:00

Following my question regarding connecting to a MySQL database in Java, I am looking

  • 0

Following my question regarding connecting to a MySQL database in Java, I am looking to create a web service in PHP. My Java program needs to ask the web service to gather some data from MySQL database and send the result back. However, I have a few dilema’s:

Firstly, my web hosts do not support Java, and therefore the server side needs to be written in PHP but the client needs to be written in Java.

Secondly, all the tutorials I have found seem to involve creating a whole web service project in order for my Java program to communicate with the web service, where as realistically only a couple of classes need to contact the PHP web service.

And, you may have already guessed but I don’t know anything about web service’s. It was just suggested that I used one in order to get around the GPL licence of the JDBC driver…

I realise that similar questions may have been asked here before but as I am a complete novice, the posts that are saw here did not contain enough information for me and I require as much help as I can get – almost a step by step guide!

Alternatively, I did think about just using standard PHP Sockets, as I am pretty sure I know how to use them. However, I don’t know how secure they are and I didn’t want to take any risks because I will be needing to retrieve information such as licence keys!

Thanks in Advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:32:47+00:00Added an answer on May 25, 2026 at 12:32 am

    You don’t need to use PHP Sockets, all you need is a simple PHP script on your web host that fetches the data you need from the MySQL DB and outputs the data to be read by your Java client.

    Your PHP script will need:

    1. To retrieve any query parameters from the Java client (probably
      via $_POST or $_GET).
    2. Information to connect to MySQL (hostname/ip address, db name,
      username, password).
    3. To run SQL query/queries to grab the data from the database.
    4. To output the data for the java client to read, in some mutually-acceptable format, such as XML, JSON, HTML, etc.

    You would structure the script something like this:

    <?php
        // 1. Read and validate input parameters
        $myquery_val = $_POST['queryval'];
    
       // 2. Connect to MySQL
    
       // 3. Fetch MySQL data
    
       // 4. Output data
    ?>
    

    To learn how to connect to MySQL and retrieve data, read up on MySQL PDO: http://php.net/manual/en/ref.pdo-mysql.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following on from my recent question regarding parsing XML files in Java I have
I'm new to Java and have the following question regarding inner classes: When implementing
I have a question regarding the execution of the following program. #include<stdio.h> int main(void)
I have a question regarding exception handling. Consider following Java code snippet. try{ //code
I'm writing a small webapp in Grails and I have the following question regarding
Following my question regarding a .NET YAML Library ... as there doesn't seem to
Quick question regarding memory management in C++ If I do the following operation: pointer
I have a question regarding the following code snippet I came across in one
Following is a question regarding using properties in class. I have been using public
One question regarding whether the following code should yield a compiler warning or not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.