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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:48:14+00:00 2026-05-18T03:48:14+00:00

I have Mysql installed on my Linux box and wrote a sample program to

  • 0

I have Mysql installed on my Linux box and wrote a sample program to access one of it’s table.
I am using ‘mysql-connector-java-5.1.10.jar’

The code is working fine if i put the jar in ‘jre/lib/ext’. However, other ways of recognizing that jar are not working. I tried with setting $CLASSPATH and tried to use ‘.’ current directory.

It’s failing with the following error :

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:185)
  • 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-18T03:48:14+00:00Added an answer on May 18, 2026 at 3:48 am

    I usually don’t use the global $CLASSPATH variable, the easiest way to get it running is

    java -cp .;/path/to/mysql-connector-java-5.1.10.jar[;<other libs>] pkg.name.MyApplication
    

    Sidenote

    If you have your application exportet to a jar with a Main-Class attribute (“executable jar”) and start it with java -jar myjar.jar, then you have to add all required libraries to the jars manifest, $CLASSPATH and -cp are ignored in this case. And that’s why I usually don’t use the -jar option…

    Edit

    To answer your additional question: If the current directory was added to the classpath by default, then the location from where the application was started could influence the application itself.

    Imagine an application inside a jar and a start command

     java -cp application.jar com.example.Main
    

    Now we have a defined environment: only the content of application.jar (and the jre classes) are on the classpath and part of the application. If the current directory was added to the classpath automatically then all files at the current location (and at locations of all subfolders) would be on the classpath too, intend or not. With a result, that the application might work if started from the users home directory but maybe not if started from the root directory (/).

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

Sidebar

Related Questions

I have installed RVM in my ubunut linux box and configured the Rails 3
I have a linux box. When I had a Windows box, I was able
I'm new to PHP and have installed on Linux to boot (also a newbie).
I have a VPS and I want to make mysql DB accept connection externally
For a web-app product which would need to be installed by the customer on
I'm attempting to use mysql after only having worked with sqlite in the past.
Does anybody know an ISO image of a up-to-date Linux distribution aimed at web
I'm running a database server in a Linux VM (Ubuntu 9.10) under VMware Fusion,
I trying to navigate my new EC2 setup and was hoping to find an
I created a virtualbox with a fresh install of ubuntu 9.10. I am trying

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.