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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:26:37+00:00 2026-05-27T10:26:37+00:00

When i connect with this code on my linux (Ubuntu 11.10) with mysql version

  • 0

When i connect with this code on my linux (Ubuntu 11.10) with mysql version 5.1 it works fine, but when i want to start my app on windows os (windows 7 with mysql 5.5) it throws exception:

org.hibernate.exception.GenericJDBCException: Cannot open connection

In both cases i was log in on localhost.
I tried to log in on root user. I have complete certainty it was correct password.
I tried to grand a all priviligates to new one user, but it was the same exception.
Another option i was try was that i catch a GenericJDBCException and program gives me this:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

I connect to database programmatically (via Hibernate AnnotationConfiguration):

annotationConfiguration = new AnnotationConfiguration();
annotationConfiguration.setProperty("hibernate.hbm2ddl.auto", "create");

// add annotatedClasses
annotationConfiguration.addAnnotatedClass(X.class);

annotationConfiguration.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.MySQLDialect");
annotationConfiguration.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
annotationConfiguration.setProperty("hibernate.connection.url", "jdbc:mysql://" + host + ":3306/" + database);
annotationConfiguration.setProperty("hibernate.connection.username", userName);
annotationConfiguration.setProperty("hibernate.connection.password", password);
annotationConfiguration.setProperty("hibernate.connection.release_mode", "auto");
//annotationConfiguration.setProperty("hibernate.query.factory_class", "org.hibernate.hql.classic.ClassicQueryTranslatorFactory");
if (StaticConstants.DEBUG) {
    annotationConfiguration.setProperty("hibernate.show_sql", "true");
} else {
    annotationConfiguration.setProperty("hibernate.show_sql", "false");
}
annotationConfiguration.configure();
sessionFactory = annotationConfiguration.buildSessionFactory();
sessionFactory.close();

I use Hibernate version 3.6.7, but i tested it on Hibernate 3.6.8 via Configuration class and it was the same result.

So my question is has someone the same problem and solve it, or anyone have any idea to solve it?

Thanks

  • 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-27T10:26:37+00:00Added an answer on May 27, 2026 at 10:26 am

    check your credentials. your password for user root is wrong

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

Sidebar

Related Questions

How do I write code to connect through Windows VPN client? I want this
I've this TcpClient code which works fine. It connects to perl server on linux
I have this code in PHP. It connects to the DB fine, but pops
I have this mySQL code that connects to my server. It connects just fine:
The following code does not work correctly on Windows (but does on Linux): sock
I have this code to connect to Active Directory and get all the groups
Im using this code for mysql connection $con = mysql_connect(localhost:/var/lib/mysql/mysql.sock, abc , xyz); if
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
My expect code does this: It does a ssh connect to another machine, sends
My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('alex@example.com.au' => 'Alex')) ->setTo(array('alex@example.com.au' =>

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.