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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:24:44+00:00 2026-06-13T02:24:44+00:00

My application runs on Linux Mandriva and can’t get a connection to the MySQL

  • 0

My application runs on Linux Mandriva and can’t get a connection to the MySQL database.

Part of my.cnf:

bind-address="127.0.0.1"
# skip- networking

I setted wait_timeout as follows:

SET GLOBAL wait_timeout = 28800;

I trying to get a connection to the database:

public class TestJdbc {
    public static void main(String[] args) {
        Connection conn = null;

        String url = "jdbc:mysql://localhost:3306/";        
        String driver = "com.mysql.jdbc.Driver";

        String dbName = "gibrid", userName = "java", 
            password = "java";      

        try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url+dbName, userName, password);
            System.out.println("Connected to the database");
            conn.close();
            System.out.println("Disconnected from database");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

I packed this class in jar and send to the server. When I try to execute it, I get the following:

    com.mysql.jdbc.CommunicationsException: 
Communications link failure due to underlying exception:

    ** BEGIN MESSAGE **

    java.net.ConnectException
    MESSAGE: Connection timed out

    STACKTRACE: java.net.ConnectException: Connection timed out
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:333)
      ...

But when I run this code from my localhost, everything is OK:

Connected to the database
Disconnected from database

What could be the problem?

  • 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-13T02:24:45+00:00Added an answer on June 13, 2026 at 2:24 am

    Can you telnet to port 3306 on that Linux server ? That will tell you if something is listening on that port or not.

    Note that if you run your code from your Windows server, the following line:

    jdbc:mysql://localhost:3306/";
    

    means you’re connecting to a service on your Windows machine, not your Linux machine.

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

Sidebar

Related Questions

I developed a command line application, whose binary runs in Linux, Windows and Mac
I have an application that runs on embedded linux (older kernel, 2.6.18). I'm using
I am porting a linux application onto android, which runs on beagle board. My
I have a JAVA application which runs on Linux. I open a socket that
My application is using wxPython and runs on Linux and Windows without modification. The
I have a small application that runs on fairly recent Linux distributions with Python
I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps
My application runs as a background process on Linux. It is currently started at
I have an application that runs on Ubuntu Linux 12.04 which needs to store
We have a Java web application running on JBoss and Linux. Production environment database

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.