• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.JDBCConnectionException

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

I am writing am application using Eclipse 3.1, MySQL Server 4.1, and hibernate 3.2.5
my hibernate.cfg.xml looks like this:

<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/eventdb</property>
<property name="connection.username"></property>
<property name="connection.password"></property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>


<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
<mapping resource="events/Event.hbm.xml"/>
</session-factory>

I have made a little ant file, but when I want to run the application, I get the error:
"java.sql.SQLException: Communication link failure: java.io.IOException, underlying cause: Unexpected end of input stream"
Can anyone tell me what the problem is ?

thank you
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mirela,

Seems like your application is not able to communicate with MySQL db server. Do you know what port is your MySQL db running on? You might want to double check your connection.url.
 
Mirela Muntean
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the MySql server is running on port 3306, and I have changed the hibernate.cfg.xml file, like his:

<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/eventdb</property>
<property name="connection.username"></property>
<property name="connection.password"></property>

and now the error is: " java.sql.SQLException: Communication link failure: Bad handshake "
What could be the problem now? What username and passowrd do I have to provide ? When I installed the server, there was already one username = root, and I put a password for hat user. These are the credentials I have to provide ,or they are not necesary ?

Thank you
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mirela,

Please checkout this link on mysql site
Connector/J

You might want to use a newer version of Connector/J which might hopefully fix the issue.
 
Mirela Muntean
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

I replaced the connector, and it worked.

Thanks very much
 
reply
    Bookmark Topic Watch Topic
  • New Topic