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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:09:01+00:00 2026-05-29T06:09:01+00:00

My code is- package textmessenger; import java.sql.*; public class Main { public static void

  • 0

My code is-

package textmessenger;
import java.sql.*;


public class Main {


    public static void main(String[] args) {
        // TODO code application logic here
        try {
        String con = "jdbc:mysql://SQL09.FREEMYSQL.NET:3306/a5189576";
        Connection connection = null;

        Statement statement = null;

        ResultSet rs = null;
        int updateQuery = 0;

            Class.forName("com.mysql.jdbc.Driver").newInstance();
            connection = DriverManager.getConnection(con, "user", "pwd");
            statement = connection.createStatement();
            String QueryString = "select * from names";
            rs = statement.executeQuery(QueryString);
            System.out.println("Executed");
        }
        catch(Exception ex){
            ex.printStackTrace();
            }
        }
    }

When I run this program, I get “Error” in the output. Where am I going wrong?
I have tried the SQL editor in NetBeans and it works perfectly fine there.
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-29T06:09:02+00:00Added an answer on May 29, 2026 at 6:09 am

    From the stacktrace you’ve now posted, You need to download the MySQL JDBC driver and include it in your project:

    http://dev.mysql.com/downloads/connector/j/

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

Sidebar

Related Questions

Here is a sample code package org.example; import java.lang.reflect.Method; class TestRef { public void
I have the following code: package application; import java.util.Timer; import java.util.TimerTask; public class Application
Here's the code: package testpack; import java.io.*; public class InputStreamReadDemo { private void readByte()
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
Java applet code package M257Applet import java.applet.*; import javax.swing.*; import java.awt.*; public class HellowApplet
Here is my code: package survival; import javax.swing.*; import java.awt.*; public class Survival extends
When I try to execute this code: package uk.org.infectogenomics.agent; import uk.org.infectogenomics.Agent.qa.Quasr; public static void
Suppose I have following code package memoryleak; public class MemoryLeak { public static int
I have a very simple code: package mygame; public class RunGame { public static
This is my code: package test; import java.util.logging.Level; import java.util.logging.Logger; class Data{ int ar[]=new

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.