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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:46:42+00:00 2026-05-15T12:46:42+00:00

Ok – I found the driver version that goes with the database.. however now

  • 0

Ok – I found the driver version that goes with the database.. however now I get the following.

Got an exception! Communications link
failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException MESSAGE:
Connection timed out: connect

STACKTRACE:

java.net.ConnectException: Connection
timed out: connect
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:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.(Socket.java:372)
at java.net.Socket.(Socket.java:215)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
at com.mysql.jdbc.Connection.(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at freelancebillingapp.customerInfoUI.jButton1MouseClicked(customerInfoUI.java:221)
at freelancebillingapp.customerInfoUI.access$000(customerInfoUI.java:12)
at freelancebillingapp.customerInfoUI$1.mouseClicked(customerInfoUI.java:59)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6266)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

** END NESTED EXCEPTION **

Last packet sent to the server was 1
ms ago.

  • 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-15T12:46:43+00:00Added an answer on May 15, 2026 at 12:46 pm

    This may not solve it, but it tells you that someone else has had this problem.

    Make sure you have the precise version of JDBC driver to match your version of MySQL.

    I would strongly urge you to rewrite your code more like this. You aren’t closing resources properly at all.

    Adapt it to your own needs. I created a local MySQL database on my machine and added a customer table. It worked just fine.

    package persistence;
    
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.ArrayList;
    import java.util.LinkedHashMap;
    import java.util.List;
    import java.util.Map;
    
    public class DatabaseUtils
    {
        private static final String URL = "jdbc:mysql://localhost:3306/contacts";
        private static final String USERNAME = "contacts";
        private static final String PASSWORD = "contacts";
    
        public static final String SELECT_SQL = "select customer_id, name, street, city, state, zip, phone, url from customer order by customer_id";
        public static final String INSERT_SQL = "insert into customer(name, street, city, state, zip, phone, url) values(?,?,?,?,?,?,?)";
    
        public static void main(String[] args)
        {
            Connection connection = null;
    
            try
            {
                connection = getConnection(URL, USERNAME, PASSWORD);
                List<Map> rows = findAllCustomers(connection);
    
                for (Map row : rows)
                {
                    System.out.println(row);                    
                }
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
            finally
            {
                close(connection);
            }
        }
    
        public static List<Map> findAllCustomers(Connection connection) throws SQLException
        {
            List<Map> rows = new ArrayList<Map>();
            PreparedStatement st = null;
            ResultSet rs = null;
    
            try
            {
                st = connection.prepareStatement(SELECT_SQL);
                rs = st.executeQuery();
                while (rs.next())
                {
                    rows.add(map(rs));                
                }
            }
            finally
            {
                close(rs);
                close(st);
            }
    
            return rows;
        }
    
        private static Map<String, Object> map(ResultSet rs) throws SQLException
        {
            Map<String, Object> row = new LinkedHashMap<String, Object>();
    
            ResultSetMetaData meta = rs.getMetaData();
    
            int numColumns = meta.getColumnCount();
            for (int i = 1; i <= numColumns; ++i)
            {
                String column = meta.getColumnName(i);
                Object value = rs.getObject(i);
                row.put(column, value);
            }
    
            return row;
        }
    
        public static Connection getConnection(String url, String username, String password) throws SQLException
        {
            Driver driver = DriverManager.getDriver(url);
    
            DriverManager.registerDriver(driver);
    
            return DriverManager.getConnection(url, username, password);
        }
    
        public static void close(Connection connection)
        {
            try
            {
                if (connection != null)
                {
                    connection.close();
                }
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
        }
    
        public static void close(Statement st)
        {
            try
            {
                if (st != null)
                {
                    st.close();
                }
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
        }
    
        public static void close(ResultSet rs)
        {
            try
            {
                if (rs != null)
                {
                    rs.close();
                }
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
        }
    
        public void rollback(Connection connection)
        {
            try
            {
                if (connection != null)
                {
                    connection.rollback();
                }
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer well you need several skills for this: how to load… May 15, 2026 at 3:14 pm
  • Editorial Team
    Editorial Team added an answer May be here : http://www.ebob42.com/cgi-bin/Soap42.exe May 15, 2026 at 3:14 pm
  • Editorial Team
    Editorial Team added an answer You can do this using Select-String in PowerShell 2.0 like… May 15, 2026 at 3:14 pm

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.