Announcement Announcement Module
Collapse
No announcement yet.
My SQL 5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • My SQL 5

    Hi,
    i have updated my Database MYSQL 5 and connector (mysql-connector-java-5.0.3-bin.jar), Dialect class (org.hibernate.dialect.MySQL5Dialect) and also update spring latest (spring-framework-2.0-rc4.jar).It gives me follwoing exception:




    Code:
    WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
    2006-09-27 11:00:42,801 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot create PoolableConnectionFactory (Communication failure during handshake. Is there a MySQL server running on localhost:3306?)
    2006-09-27 11:00:42,811 [main] WARN  org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
    org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communication failure during handshake. Is there a MySQL server running on localhost:3306?)
    	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
    	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
    	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:80)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:777)
    	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:703)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1003)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:348)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:156)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3659)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4097)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Caused by: java.sql.SQLException: Communication failure during handshake. Is there a MySQL server running on localhost:3306?
    	at com.mysql.jdbc.MysqlIO.init(MysqlIO.java:692)
    	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1657)
    	at com.mysql.jdbc.Connection.connectionInit(Connection.java:1076)
    	at com.mysql.jdbc.Driver.connect(Driver.java:313)
    	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
    	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
    	at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
    	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
    	... 32 more
    2006-09-27 11:00:42,841 [main] INFO  org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQL5Dialect
    2006-09-27 11:00:42,851 [main] INFO  org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
    2006-09-27 11:00:42,851 [main] INFO  org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    2006-09-27 11:00:42,851 [main] INFO  org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
    2006-09-27 11:00:42,851 [main] INFO  org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled

  • #2
    Shahzad, the error states that the server configuration is incorrect - the client cannot connect to the server (
    Is there a MySQL server running on localhost:3306?)

    Try doing some diagnostics separately - i.e. run a mysql client and try connecting
    to the server making sure you use the same parameters and settings.
    Note that this problem is not Spring-specific - you simply don't have the mysql
    configuration correct.

    Comment


    • #3
      Connected USing MySQLFront

      Hi,
      i have checked with MySQLFront with same username and password.And it works f9.

      Comment


      • #4
        Hi Shahzad,

        I had something similar before when running mysql in a Linux box - JDBC couldn't connect while some client tools could. I found out that for JDBC to be able to connect to mysql server, the server must have tcp/ip mode connection enabled and mine was only set up with the shared-memory mode. Don't know if your problem is caused by exactly that, just a thought.

        HTH.

        Comment


        • #5
          Hi Shahzad,

          I had a devil of a time trying to connect using apache commons. But switching to C3P0 made life easier, imho.
          Cheers,
          Peter Adelmann

          Comment


          • #6
            cp30

            Hi,
            Can u send me cp30 configuations.

            thanx

            Comment


            • #7
              Sure,

              First, there are many posts on this site regarding it. I did a search and got back some great info. I went to the http://sourceforge.net/projects/c3p0/ and grabbed the latest. I used one of the jars when I was working with mySQL. The docs are great that come along. Here's the entry which I put in my ApplicationContext.xml (the database name was ripit)
              Code:
                  
                  <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
                  	destroy-method="close">
                      <property name="driverClass"><value>com.mysql.jdbc.Driver</value></property>
                      <property name="jdbcUrl"><value>jdbc:mysql://localhost:3306/ripit</value></property>
                      <property name="user"><value>root</value></property>
                      <property name="password"><value>peter</value></property>
                  </bean>
              I didn't have much of a problem after that...
              Hope this helps....
              Peter

              Comment

              Working...
              X