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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:17:28+00:00 2026-06-04T20:17:28+00:00

I’ve been trying for a while to connect to my database, and I am

  • 0

I’ve been trying for a while to connect to my database, and I am pretty close now I think.
But com.mysql.jdbc.Driver refuses to load.
Here’s my code:

import java.sql.*;
import com.apple.eawt.*;
import com.mysql.jdbc.Driver;

public class MySQL {
    public MySQL() {
        Connection conn = null;

        try
        {
            String userName = "my_username";
            String password = "*******";
            String url = "jdbc:mysql://korilu.nl/phpMyAdmin/";
            Class.forName ("com.mysql.jdbc.Driver").newInstance ();
            conn = DriverManager.getConnection (url, userName, password);
            System.out.println ("Database connection established");
        }
        catch (SQLException ex)
        {
            System.err.println ("Cannot connect to database server (SQLException)");
            System.out.println(ex.getMessage());
        }
        catch (ClassNotFoundException ex) {
            System.err.println ("Cannot connect to database server (ClassNotFoundException)");
            System.out.println(ex.getMessage());
        }
        catch (InstantiationException ex) {
            System.err.println ("Cannot connect to database server (InstantiationException)");
            System.out.println(ex.getMessage());
        }
        catch (IllegalAccessException ex) {
            System.err.println ("Cannot connect to database server (IllegalAccesException)");
            System.out.println(ex.getMessage());
        }
        finally
        {
            if (conn != null)
            {
                try
                {
                    conn.close ();
                    System.out.println ("Database connection terminated");
                }
                catch (Exception e) { /* ignore close errors */ }
            }
        }
    }

    public static void main(String args[]) {
        new MySQL();
    }

}

Currently it says: package com.mysql.jdbc does not exist, although XCode autocompletes the import line above.
I think I messed up with adding the package to my project, because I did not know how.
I just ctrl+clicked my target and selected Add to target... and added the com folder with the .java files I downloaded.
I think that the compiler doesn’t recognize it as a package but I don’t know how to make it a package.

P.S.
I’m not quite sure about that URL, but that’s not the problem for now (but I won’t mind someone telling me where antagonist stores their databases).

  • 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-04T20:17:29+00:00Added an answer on June 4, 2026 at 8:17 pm

    I am not sure how Xcode handles this as I’ve not used it for Java development, however the usual cause of this error is the MySQL jdbc (connector) jar file not being on the classpath. Can you show us the command Xcode is using to launch the jvm?

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.