Results 1 to 3 of 3

Thread: How to get started with mysql and java with jdbc?

  1. #1
    Join Date
    Apr 2005
    Beans
    130

    How to get started with mysql and java with jdbc?

    So, it there a script/how to anyplace that will tell me how to set things up? I basically just want to be able to connect to my mySQL db using jdbc. I tried some things, but always get exceptions when trying to connect.

    I've tried searching, but so many threads on complicated/obscure issues.... I just want basic functionality

    thanks

  2. #2
    Join Date
    Apr 2005
    Beans
    130

    Re: How to get started with mysql and java with jdbc?

    Well, I got a step further by copying the mysql connector.jar file to the jre/lib/ext directory.

    But now I cannot connect to the db using the user name I created using a java program:
    Code:
    $ java Connect
    caught SQLException: Access denied for user: 'java@localhost.localdomain' (Using password: YES)
    I am able to connect to the database using that username with mysql command. And it should have privleges fro @'%' (any host), @localhost, @127.0.0.1, @localhost.localdomain..

    [edit] also cannot connect as root..

  3. #3
    Join Date
    Apr 2005
    Beans
    130

    Re: How to get started with mysql and java with jdbc?

    OK, seems like I got it to work by:

    1. Deleting the user I was trying to connect with
    2. Recreating that user
    3. Adding a host for that user of % (for anyplace)
    4. Removing the localhost host (so now only has 'one host' of %)


    So, I suppose that the reason it didn't work befroe was that it had multiple hosts allowed for this user, i.e. localhost, localhost.localdomain, %, 127.0.0.1 and they conflicted with each other or something

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •