-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: com.mysql.jdbc.CommunicationsException
PostPosted: Sat Jan 19, 2008 4:37 pm 
Newbie

Joined: Sat Jan 19, 2008 4:16 pm
Posts: 1
hi here,

I'm tyring to connect to a local mysql db using hibernate;
I can connect to the same db using the java JDBC api with :

Class.forName("com.mysql.jdbc.Driver").newInstance();

DriverManager.getConnection("jdbc:mysql:///marker" + "?socketFactory=com.mysql.jdbc.NamedPipeSocketFactory", "root", "boo10rad");

I have been able to connect to oracle on an external server using hibernate and last summer to my local mysql using hibernate.

I'm presuming that somewhere something has changed but what ?
is there a clue in that using JDBC requires the socketFactory?

the hibernate.cfg file has the correct driver_class, correction_url, and dialect; the driver and hibernate jars are on the classpath.

thank you for any assistance that you may be able to provide.

Brian

the output is:

Jan 19, 2008 3:23:29 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
Jan 19, 2008 3:23:30 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jan 19, 2008 3:23:30 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Jan 19, 2008 3:23:30 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Jan 19, 2008 3:23:30 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Jan 19, 2008 3:23:30 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Jan 19, 2008 3:23:31 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : \Book.hbm.xml
Jan 19, 2008 3:23:32 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: ca.deeds.utoronto.userxx.hibernate.Book -> books
Jan 19, 2008 3:23:32 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Jan 19, 2008 3:23:32 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Jan 19, 2008 3:23:32 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Jan 19, 2008 3:23:32 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
Jan 19, 2008 3:23:33 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/marker
Jan 19, 2008 3:23:33 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=****, autocommit=true}
Jan 19, 2008 3:23:34 PM org.hibernate.cfg.SettingsFactory buildSettings
WARNING: Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying except
:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection refused: connect

STACKTRACE:

java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
.......


Top
 Profile  
 
 Post subject: Re: com.mysql.jdbc.CommunicationsException
PostPosted: Sat Jan 19, 2008 11:33 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
the error is down in the jdbc driver. It is not a hibernate issue.

Code:
java.net.ConnectException: Connection refused: connect


Make sure the port is open on local host and it accepts connections.

Farzad-


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.