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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:50:37+00:00 2026-06-15T09:50:37+00:00

I have a Java program that successfully connects to a mysql database that is

  • 0

I have a Java program that successfully connects to a mysql database that is hosted on godaddy’s server. I can read from that db with out issue, however, when I try to write to it with INSERT or UPDATE for example, the query does not execute. I am using the ‘admin’ account that I set up through godaddy, I realize this is not the root account. I have checked and verified that the connection is not read only, and have logged out of phpmyadmin while the query ran. I’m not sure what else I can try or if anyone has experienced this issue.

Maybe a setting to the connection I have failed to set? Or maybe its not possible since the db is hosted on godaddy’s servers?

Any help is great!

Thanks.

Here is some relevant code:
Connection to db:

Connection con;
public DBconnection(String url, String user, String pass)
{
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            con = DriverManager.getConnection (url,user,pass);


            if(!con.isClosed())
                System.out.println("connecton open");
        } 
        catch (InstantiationException e) {e.printStackTrace();} 
        catch (IllegalAccessException e) {e.printStackTrace();} 
        catch (ClassNotFoundException e) {e.printStackTrace();} 
        catch (SQLException e) {e.printStackTrace();}
}

Send Query:

public ResultSet executeQuery(String query)
{
    ResultSet rs = null;

    try {
        Statement stmt = (Statement) con.createStatement();
        rs = stmt.executeQuery(query);

        //while(rs.next())
            //System.out.println(rs.getString("ticket_num"));
    } 
    catch (SQLException e) {}   

    return rs;
}

Insert Query (works in phpmyadmin):

conn.executeQuery("INSERT INTO tickets VALUES(55555,'12/01/2012','me','reports','test','','','0','Nope')");
  • 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-15T09:50:38+00:00Added an answer on June 15, 2026 at 9:50 am

    Use, statement.executeUpdate() to do an INSERT query.

    FROM API of Statement.executeUpdate(String sql):

    Executes the SQL statement in this PreparedStatement object, which
    must be an SQL Data Manipulation Language (DML) statement, such as
    INSERT, UPDATE or DELETE; or an SQL statement that returns nothing,
    such as a DDL statement.

     executeUpdate("INSERT INTO tickets VALUES(55555,'12/01/2012','me','reports','test','','','0','Nope')");
    

    And i strongly advice you to use PreparedStatemnt rather than simple Statement to perform SQL using JDBC.

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

Sidebar

Related Questions

I have a Java program that executes from Spring Qquartz every 20 seconds. Sometimes
I have a Java program that connects to a webserver using SSL/TLS, and sends
I have successfully created a Java program that runs fine on my development computer,
I have a Java Program that will import data from a DB2 table to
I have a java program that performs 5 different tasks. When I run the
I have a java program that is running in the background(Windows). I would like
I have a Java program that runs many small simulations. It runs a genetic
I have a java program that will work with a variety of Java Beans.
I have a Java program that is launched by a batch file with a
I have a Java program that generates Java classes for my application. Basically it

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.