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 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

Related Questions

Well, I'm gonna be pretty straightforward here, I just have a piece of code
Here is the code, it's pretty straightforward. class Foo { public: void print() {
Pretty straightforward question here: is the enumeration order in a for loop guaranteed to
I want to make an web application (platform) that does pretty straightforward stuff: Users
Though my question is pretty straightforward, I failed to find an answer around here:
Pretty straightforward question. I'm building an app which reads data from a SQL Server
Pretty new flixel/AS3 user here, though not entirely new to coding. Anyways, the error
Pretty straightforward: I'm looking to do the same as this but in winforms. Everything
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
My question is pretty straightforward. How to create a transitional scroll which looks like

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.