Java MYSQL Connection зависает в Windows 7, работает на Mac - PullRequest
0 голосов
/ 06 июля 2010

Те же программы работают на Mac, но, похоже, не работают на Windows. Я попытался использовать и hibernate, и обычное mysql.connection, но оба зависли.

Все мои брандмауэры отключены, и у меня нет проблем с подключением к базе данных через сторонние программы, такие как sqlyog, или даже через генератор запросов HQL в netbeans. Но когда он скомпилирован, соединение с базой данных кажется зависшим примерно на 5 минут, а затем выводит следующую ошибку.

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure    
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
            at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343)
            at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308)
            at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
            at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
            at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
            at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
            at java.sql.DriverManager.getConnection(DriverManager.java:582)
            at java.sql.DriverManager.getConnection(DriverManager.java:154)
            at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
            at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
            at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
            at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
            at checkin.HibernateUtil.<clinit>(HibernateUtil.java:24)
            at checkin.CheckInTools.executeHQLQuery(CheckInTools.java:29)
            at checkin.CheckInTools.checkPassword(CheckInTools.java:43)
            at checkin.CheckInView$4.run(CheckInView.java:114)
            at java.lang.Thread.run(Thread.java:619) Caused by: java.net.SocketException: Malformed reply from SOCKS server
            at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:90)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:429)
            at java.net.Socket.connect(Socket.java:529)
            at java.net.Socket.connect(Socket.java:478)
            at java.net.Socket.<init>(Socket.java:375)
            at java.net.Socket.<init>(Socket.java:218)
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292)
            ... 23 more 06/07/2010 12:58:15 AM org.hibernate.dialect.Dialect <init> INFO: Using dialect: org.hibernate.dialect.MySQLDialect 06/07/2010 12:58:15 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory INFO: Using default transaction strategy (direct JDBC transactions) 06/07/2010 12:58:15 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Automatic flush during beforeCompletion(): disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Automatic session close at end of transaction: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Scrollable result sets: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: JDBC3 getGeneratedKeys(): disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Connection release mode: auto 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Maximum outer join fetch depth: 2 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Default batch fetch size: 1 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Generate SQL with comments: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Order SQL updates by primary key: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Order SQL inserts for batching: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 06/07/2010 12:58:15 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init> INFO: Using ASTQueryTranslatorFactory 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {} 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: JPA-QL strict compliance: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Second-level cache: enabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Query cache: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory createCacheProvider INFO: Cache provider: org.hibernate.cache.NoCacheProvider 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Structured second-level cache entries: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Statistics: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Deleted entity synthetic identifier rollback: disabled 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Default entity-mode: pojo 06/07/2010 12:58:15 AM org.hibernate.cfg.SettingsFactory buildSettings INFO: Named query checking : enabled 06/07/2010 12:58:15 AM org.hibernate.impl.SessionFactoryImpl <init> INFO: building session factory 06/07/2010 12:58:17 AM org.hibernate.impl.SessionFactoryObjectFactory addInstance INFO: Not binding factory to JNDI, no JNDI name configured

1 Ответ

0 голосов
/ 06 июля 2010

Когда я вырезал и вставил вашу ошибку в Google, это вернуло это . Попробуйте его со стандартным портом 3306, если вы его не используете, и посмотрите, улучшится ли это.

Я вырезал и вставил вашу ошибку в Google и получил эту ссылку обратно:

http://bugs.mysql.com/bug.php?id=47494

Не знаю, совпадает ли это с вашей ситуацией. Я бы порекомендовал эту практику в будущем. Я буду быстрее, чем ждать 6-8 недель ответа здесь.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...