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

  • Home
  • SEARCH
  • 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 99757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:26:55+00:00 2026-05-11T00:26:55+00:00

Pretty straightforward stuff, here — I’m just not good enough with mysql to understand

  • 0

Pretty straightforward stuff, here — I’m just not good enough with mysql to understand what it wants from me.

I’ve got a short java test-case that opens a connection on mysql on my dev system but, when I try to put it to my server, it fails.

Any help in tracking this down would be most appreciated.

Thanks!

Test Code

import  java.util.*; import  java.sql.*;  public  class   mysqltest {      static  public  void  getDBConnection() {         System.out.println ('Start of getDBConnection.');          Connection  conn        = null;         String      url         = 'jdbc:mysql://localhost:3306/';         String      dbName      = 'magnets_development';         String      driver      = 'com.mysql.jdbc.Driver';         String      userName    = '*****';  // blanked for publication         String      password    = '*****';          try {             Class.forName (driver).newInstance();             System.out.println ('driver.newInstance gotten.');             conn = DriverManager.getConnection (url+dbName, userName, password);             System.out.println ('Connection gotten: ' + conn + '.');             Statement sql     = conn.createStatement ();             ResultSet results = sql.executeQuery ('use ' + dbName + ';');         }         catch (Exception ex) {             System.out.println ('*** Got exception.');             ex.printStackTrace();         }     }      public static void main(String args[]) {         System.out.println ('Main started.');         mysqltest.getDBConnection();     } } 

Dev System Output (Expected/correct response)

olie$ java mysqltest Main started. Start of getDBConnection. Properties set. driver.newInstance gotten. Connection gotten: com.mysql.jdbc.Connection@c980c9. olie$  

Server Output (Error I’m trying to track-down) (Some blank lines removed.)

mini$ java mysqltest Main started. Start of getDBConnection. Properties set. driver.newInstance gotten. *** Got exception. com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:   ** BEGIN NESTED EXCEPTION **   java.net.ConnectException MESSAGE: Connection refused  STACKTRACE:  java.net.ConnectException: Connection refused     at java.net.PlainSocketImpl.socketConnect(Native Method)     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)     at java.net.Socket.connect(Socket.java:520)     at java.net.Socket.connect(Socket.java:470)     at java.net.Socket.<init>(Socket.java:367)     at java.net.Socket.<init>(Socket.java:209)     at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)     at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)     at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)     at com.mysql.jdbc.Connection.<init>(Connection.java:1555)     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)     at java.sql.DriverManager.getConnection(DriverManager.java:525)     at java.sql.DriverManager.getConnection(DriverManager.java:140)     at mysqltest.getDBConnection(mysqltest.java:34)     at mysqltest.main(mysqltest.java:49)  ** END NESTED EXCEPTION **  Last packet sent to the server was 3 ms ago.     at com.mysql.jdbc.Connection.createNewIO(Connection.java:2847)     at com.mysql.jdbc.Connection.<init>(Connection.java:1555)     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)     at java.sql.DriverManager.getConnection(DriverManager.java:525)     at java.sql.DriverManager.getConnection(DriverManager.java:140)     at mysqltest.getDBConnection(mysqltest.java:34)     at mysqltest.main(mysqltest.java:49) mini$  
  • 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. 2026-05-11T00:26:56+00:00Added an answer on May 11, 2026 at 12:26 am

    Bah! My apologies — I just had ‘local connections only’ set up. I was confused by the fact that the java app was running locally (so seemed a ‘local connection’ but, because it is connecting via TCP, it’s a ‘remote’ connection, even though it originates on localhost.

    I will eventually learn how to administer these things. In the mean time, I hope someone else can learn from my mistakes.

    Thank you to all who put time into trying to help me. I have since allowed ‘remote’ connections, but all of my user-accounts are ‘username’@’localhost’ only (i.e., there is no ‘username’@’%’, which would allow any machine to connect.) Hopefully, I got that part right, at least.

    Thanks again!

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I wrote a fairly long answer to similar problem in… May 12, 2026 at 12:56 am
  • Editorial Team
    Editorial Team added an answer The subdialog element can be used to transition to forms… May 12, 2026 at 12:56 am
  • Editorial Team
    Editorial Team added an answer You need to save the timeoutID returned from setTimeout. You… May 12, 2026 at 12:56 am

Related Questions

Pretty straightforward stuff, here -- I'm just not good enough with mysql to understand
--EDIT-- I believe this is a valid question that may have multiple answers (as
I want to make an web application (platform) that does pretty straightforward stuff: Users
I have no clue about trigonometry, despite learning it in school way back when,
So I've got various reports that consist of a DataSet rendered in a Tablix...

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.