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 8769583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:22:39+00:00 2026-06-13T17:22:39+00:00

I have a soap web service that is connected to mySQL database. It has

  • 0

I have a soap web service that is connected to mySQL database. It has two methods, one is insert() and the other is verify(). The first one enables the user to enter data such as name, email and password. It saves the records in the database successfully.

However am having problems with writing the verify method. It has as input parameters, email and password. It must compare the data entered with those stored in the database and return “registered” or “not registered” if it cant find the match in mysql database. Am having problem writing the codes. Could you please help, am new to jdbc and java web services. Am using netbeans.
Thanks a lot.

Here are my codes:

    @WebMethod(operationName = "insert")
    public String insert(@WebParam(name = "name") String name,
    @WebParam(name = "email") String email,
    @WebParam(name = "password") String password {
    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con =          DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "1234");
        PreparedStatement st = con.prepareStatement("insert into register values(?,?,?)");
        st.setString(1, name);
        st.setString(2, email);
        st.setString(3, password);
        st.executeUpdate();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return "record inserted";
}

/**
 * Web service operation
 */
@WebMethod(operationName = "Verify")
public String CheckUser(@WebParam(name = "email") String email,  
@WebParam(name = "password") String password) {

        Class.forName("com.mysql.jdbc.Driver");
        Connection con =  DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "1234");

If
 // problems to write this statement!!! I need to compare the username and password 
// with some select * from register where password == @password and email == @email?

 return "Registered user";
 else 
    return "Not registered";

}
  • 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-06-13T17:22:40+00:00Added an answer on June 13, 2026 at 5:22 pm

    This example could work (you might have to change column names in the query). Also, you should close the connection in the insert method, in the same way that this example.

        Connection con = null;
    
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "1234");
            PreparedStatement st = con.prepareStatement("select 1 from register where password = ? and email = ? and name = ?");
            st.setString(1, password);
            st.setString(2, email);
            st.setString(3, name);
    
            ResultSet result = st.executeQuery();
    
            if (result.next()) { //.next() returns true if there is a next row returned by the query.
                return "Registered user";
            } else {
                return "Not registered";
            }
    
    
        } catch (Exception e) {
            //TODO manage the exception.
        } finally {
            if (con != null) {
                try {
                    con.close();
                } catch (SQLException e) {}
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .Net 4 project that has to consume a SOAP Web Service.
I Have an internal SOAP Web service that is being called from an external
I have a complex RIA client that communicates with a WCF SOAP web service,
I have an ASP.NET web service running that accepts both HTTP POST and SOAP
I have an application that connects via https to a SOAP-based web service that
I have defined a web service that will return the data from my mysql
Given: Multiple clients with a Service.asmx page that has some web methods that I
I have to use several SOAP messages to get data from a web service.
I have to connect to a third party web service that provides no wsdl
I'am going to have to interact with a SOAP web service, using a C++

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.