0

can't connect to mysql on linux

asked 2015-08-31 09:11:03 +0800

ntsetso gravatar image ntsetso
59 1 4

I developed a zk application with hibernate and mysql on eclipse. The application runs perfectly from eclipse. I tested the application on windows with locally installed tomcat and mysql successfully. When I try to run the same application on a debian server the application displays a message box containing: Cannot open connection [SQL: 1044, 42000]. I have another java application running on the same server and connecting to mysql smoothly. I’ve googled a lot and can’t find solution. Where can I look for the cause of this problem?

delete flag offensive retag edit

3 Answers

Sort by » oldest newest most voted
0

answered 2015-08-31 09:23:58 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

Your question is very bad, we don't even have a real error except the small thing you give.

For next time questions, please post the (only important piece if you know what to take) stacktrace.

Now, If I google your fault I came accros this :

ERROR 1044 (42000): Access denied for user xxx to database xxx

So I should check your propertie file (or JNDI file) if your settings are correct.

Greetz chill.

link publish delete flag offensive edit
0

answered 2015-08-31 09:47:34 +0800

ntsetso gravatar image ntsetso
59 1 4

Sorry if bad question. All I wanted was to explain what the situation is. Please point me where can I check for errors. What “propertie file” are you referring? Below is my hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/clinisoft?createDatabaseIfNotExist=true</property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.connection.password">p3ermed</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>[. . .]
link publish delete flag offensive edit

Comments

I'm guessing localhost:3306 is not the right address for your database. It's normally on other server then your application server so try changing that to the correct ip adres (or name). This can explain why you can't connect.

chillworld ( 2015-08-31 10:03:17 +0800 )edit

Normally they put those values in a propertie file so you can have different prop files for dev, ts, acc and prod without changing your application.

chillworld ( 2015-08-31 10:04:27 +0800 )edit

do you have it working?

chillworld ( 2015-09-01 08:29:06 +0800 )edit
0

answered 2015-09-01 12:44:50 +0800

ntsetso gravatar image ntsetso
59 1 4

Tks for replying. I found what the problem was in /var/log/tomcat7/catalina.xxxx-xx-xx.log

Rgds, ntsetso

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-08-31 09:11:03 +0800

Seen: 45 times

Last updated: Sep 01 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More