我是新的Hibernate。我正在尝试运行我的第一个Hibernate示例。
我在本地系统中安装了db2 10.5服务器。
我的Hibernate配置文件:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2://localhost:5000/sample</property>
<property name="connection.username">db2admin</property>
<property name="connection.password">db2admin</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>
<property name="show_sql">true</property>
<mapping class ="com.googlesvn.practice.examples.hibernate.ramaschi.sample.miscDto.UserDetailsDto"></mapping>
</session-factory>
</hibernate-configuration>
我的示例数据库已启动并能够运行查询。当我尝试运行我的示例Hibernate程序时,它会引发以下异常。
org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:132)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator$1$1.convert(BasicConnectionCreator.java:118)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:140)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:58)
at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:75)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:106)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at com.googlesvn.practice.examples.hibernate.runner.HibernateRunner.main(HibernateRunner.java:27)
Caused by: com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc][t4][2043][11550][4.19.26]
Exception java.net.ConnectException: Error opening socket to server localhost/127.0.0.1 on port 5,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001
at com.ibm.db2.jcc.am.kd.a(Unknown Source)
at com.ibm.db2.jcc.am.kd.a(Unknown Source)
at com.ibm.db2.jcc.t4.ac.a(Unknown Source)
at com.ibm.db2.jcc.t4.ac.<init>(Unknown Source)
at com.ibm.db2.jcc.t4.a.b(Unknown Source)
at com.ibm.db2.jcc.t4.b.newAgent_(Unknown Source)
at com.ibm.db2.jcc.am.Connection.initConnection(Unknown Source)
at com.ibm.db2.jcc.am.Connection.<init>(Unknown Source)
at com.ibm.db2.jcc.t4.b.<init>(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:55)
... 13 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:383)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:245)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:232)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:377)
at java.net.Socket.connect(Socket.java:539)
at com.ibm.db2.jcc.t4.w.run(Unknown Source)
at java.security.AccessController.doPrivileged(AccessController.java:251)
... 25 more
我的Hibernate属性是正确的。我可以从我的网络空间管理控制台测试连接。
当我目瞪口呆时,连接被拒绝了:连接。ERRORCODE=-4499,SQLSTATE=08001错误,它表示需要设置tcpip属性
db2set DB2COMM=tcpip
db2stop
db2start
我不确定应该在哪里运行这些推荐,我尝试了db2推荐窗口,但它不起作用。
我正在使用db2jcc4。我在websphere管理控制台中用于连接池的jar
请帮我解决这个问题。谢谢
默认情况下,DB2使用端口50000,但您在JDBC URL中指定了5000。除非您在安装DB2配置后专门修改了它,否则我会尝试在端口号中添加一个零:
<property name="connection.url">jdbc:db2://localhost:50000/sample</property>
线程“main”org.springframework.web.client.resourceAccessException中的异常:“http://localhost:8081/footballershirt/footballershirts”的GET请求上的I/O错误:拒绝连接:连接;嵌套的异常是java.net.connectException:Connection:Connection a
所以我在很长时间后再次安装了Android Studio,它要求我配置代理,所以我照做了。我测试了连接,它起作用了。 然后它让我为Gradle配置代理设置,我使用了相同的配置。 现在,在加载最新的 Vuforia 示例项目时,我收到一个错误: 分级同步失败:连接被拒绝:连接 我在网上到处都找遍了,但找不到解决办法。不可能是代理设置;我已经像IDE一样配置了Gradle。
我正试图使用IBM Type 4 JDBC驱动程序连接到远程DB2。这是我的配置: 服务器: Windows 7 professional DB2 LUW V10.5 DB2 SVCENAME=50000 TCP/IP通信 客户: 苹果操作系统V10.10.3 我的理解是,如果您用Java编写客户端应用程序并使用类型4-纯Java-驱动程序,客户端不必安装客户端。该应用程序将使用DRDA直接连接到
我已经从另一个系统复制了解决方案文件,并试图在我的机器上运行它:为此,我已经转到项目文件夹,删除了以前的解决方案文件,并复制了新的解决方案文件。 现在,它开始给我错误。因此,我从这里得到了一个解决方案:当试图连接到运行IISExpress的本地主机时,如何解决ERR_CONNECTION_REVIDED-错误502(无法从Visual Studio调试)? 根据它,我将端口号从1049改为1052