天道酬勤,学无止境

H2 jdbc Connection refused: connect 90067-147

I got a project to upgrade and it is using h2 DB with jdbc driver. During the build I have a systematic error on connection:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Connection is broken: "Connection refused: connect" [90067-147]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
at org.h2.message.DbException.get(DbException.java:156)
at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:380)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:271)
at org.h2.engine.SessionRemote.createSession(SessionRemote.java:265)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

I don't see why the connection is refused, the server is well started on the same URL, PORT and DB as the one requested.

The server is well started, but the error happen when I want to open the connection:

Connection connection = DriverManager.getConnection(DBURL, DBUSER, DBPWD + " " + DB_PWD);

Any idea about what can be the cause?

Update: This problem was not related to the firewalls but mainly to the server DB path.

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • 如何显示本地 h2 数据库(Web 控制台)的内容?(How to show content of local h2 database(web console)?)
    问题 最近我加入了一个新团队,这里的人使用 h2 进行存根服务。 我想知道是否可以使用 Web 界面显示该数据库的内容。 在工作中,它可以通过访问localhost:5080 我有一个使用 h2 数据库的项目,但是当我点击localhost:5080时我看不到 h2 Web 控制台 我也试过localhost:8082 - 它也不起作用。 我的项目配置(成功运行): <bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"> <property name="targetName" value="dataSource" /> </bean> <bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"> <property name="targetName" value="dataSource" /> </bean> <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"> <property name="driverClassName"
  • How to show content of local h2 database(web console)?
    Recently I joined a new team and here guys use h2 for stub service. I was wondering whether I can show the content of this database using web interface. At work it is available by going to localhost:5080 I have a project where I use h2 database, but I cannot see the h2 web console when I hit localhost:5080 I tried also localhost:8082 - it also doesn't work. My project configuration (works successfully): <bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean"> <property name="targetName" value="dataSource" /> </bean> <bean id="wrappedDataSource" class="net.bull
  • spring-boot datasource profiles w/ application.properties
    Updated Question based upon feedback: I have a spring-boot application that has three databases: H2 for integration testing, and Postgresql for qa & production. Since spring-boot creates a default datasource for you, I don't have anything defined for my integration tests. I thought I would use application.properties to define my datasource connection values but I am not certain what is the best way to handle this. I have two files: src/main/resources/application.properties spring.profiles.active=production appName = myProduct serverPort=9001 spring.datasource.url=jdbc:postgresql://localhost
  • H2-Console is not showing in browser
    I am working on SpringBoot api and using H2 database with following property settings. spring.h2.console.enabled=true spring.datasource.name=test spring.datasource.username=sa spring.datasource.password= spring.datasource.driver-class-name=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.initialization-mode = embedded spring.datasource.url=jdbc:h2:mem:test spring.jpa.hibernate.ddl-auto = update When I want to use browser to view the H2 database console through 'http://localhost:8082/h2-console', a screen open in browser with connect and test
  • DB2 jdbc connection error Connection refused. ERRORCODE=-4499, SQLSTATE=08001
    I have a new DB2 server (v10.5.0.3), and I can connect to the database locally just fine. When trying to connect from a remote server using JDBC I am getting the "Connection refused. ERRORCODE=-4499, SQLSTATE=08001" error. Based on information found here https://www-304.ibm.com/support/docview.wss?uid=swg21403644 I have confirmed that [db2inst1@db2 ~]$ db2set -all [i] DB2COMM=TCPIP [i] DB2AUTOSTART=YES [g] DB2SYSTEM=db2.xxxx.com [g] DB2INSTDEF=db2inst1 [g] DB2ADMINSERVER=xxxxxx and [db2inst1@db2 ~]$ db2 get database manager configuration | grep -i svce TCP/IP Service name (SVCENAME) = 50001
  • 错误:到主机的TCP / IP连接失败。 java.net.ConnectException:连接被拒绝:connect(Error:The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect )
    问题 我在用 Windows 7的 Netbeans IDE 7.1.2 SQL Server管理Studio Express 2005 JDK1.6 连接到数据库时出现以下错误: com.microsoft.sqlserver.jdbc.SQLServerException:与主机的TCP / IP连接失败。 java.net.ConnectException:连接被拒绝:connect 我的连接字符串是: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection connection = DriverManager.getConnection( "jdbc:sqlserver://127.0.0.1:1433;databaseName=dbcm;" + "user=sa;password=sa"); 我检查了以下内容: 在SQL Server配置管理器中,SQLEXPRESS的协议:启用了TCP / IP实际上,我也启用了剩余的3个。 SQL Server(SQLExpress)和SQL Browser Service都在运行。 回答1 我按照以下步骤使用JDBC成功连接到SQLExpress实例: 使用SQL Express配置TCP / IP通信打开SQL Server配置管理器。
  • connection refused error when running Nutch 2
    I am trying to run Nutch 2 crawler on my system but I get the following error: Exception in thread "main" org.apache.gora.util.GoraException: java.io.IOException: java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167) at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135) at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:69) at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:243) at org.apache.nutch.crawl.Crawler
  • What to do to make the HSQL driver working?
    I'm currently learning some database tricks in Java and I found this nice book I'm reading. At some point, it encourages me to try a manual database connection with the following class: import java.sql.DriverManager; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; public class DemoSelect { public static void main(final String[] arguments) { // Connection parameters String usr = "sa"; String pwd = ""; String driver = "org.hsqldb.jdbcDriver"; String url = "jdbc:hsqldb:hsql://localhost/xdb"; Connection con = null; PreparedStatement pstm = null; ResultSet
  • Does H2 support the serializable isolation level?
    Wikipedia describes the Phantom read phenomenon as: A phantom read occurs when, in the course of a transaction, two identical queries are executed, and the collection of rows returned by the second query is different from the first. It also states that with serializable isolation level, Phantom reads are not possible. I'm trying to make sure it is so in H2, but either I expect the wrong thing, or I do a wrong thing, or something is wrong with H2. Nevertheless, here's the code: try(Connection connection1 = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASSWORD)) { connection1
  • How to reuse the same connection with a Spring's JdbcTemplate?
    I have the following code: @Test public void springTest() throws SQLException{ //Connect to the DB. DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.h2.Driver"); dataSource.setUrl("jdbc:h2:/data/h2/testa"); dataSource.setUsername(""); dataSource.setPassword(""); JdbcTemplate jt=new JdbcTemplate(dataSource); jt.execute("SELECT 1"); jt.execute("SELECT 1"); } I expect the two execute() lines to reuse the same connection. However, the log output says: 2011-02-10 12:24:17 DriverManagerDataSource [INFO] Loaded JDBC driver: org.h2.Driver 2011-02
  • H2内存数据库。 找不到表格(H2 in-memory database. Table not found)
    问题 我有一个URL为"jdbc:h2:test"的H2数据库。 我使用CREATE TABLE PERSON (ID INT PRIMARY KEY, FIRSTNAME VARCHAR(64), LASTNAME VARCHAR(64));创建一个表CREATE TABLE PERSON (ID INT PRIMARY KEY, FIRSTNAME VARCHAR(64), LASTNAME VARCHAR(64)); 。 然后,我使用SELECT * FROM PERSON从此(空)表中选择所有内容。 到目前为止,一切都很好。 但是,如果将URL更改为"jdbc:h2:mem:test" ,唯一的区别是数据库现在仅在内存中,这给了我org.h2.jdbc.JdbcSQLException: Table "PERSON" not found; SQL statement: SELECT * FROM PERSON [42102-154] org.h2.jdbc.JdbcSQLException: Table "PERSON" not found; SQL statement: SELECT * FROM PERSON [42102-154] 。 我可能在这里缺少一些简单的东西,但是任何帮助将不胜感激。 回答1 DB_CLOSE_DELAY=-1 hbm2ddl创建表后关闭连接
  • 如何在 Spring 管理的 MySQL JDBC 连接上设置 useUnicode=true 和 characterEncoding=utf8 属性(How to set useUnicode=true and characterEncoding=utf8 properties on Spring-managed MySQL JDBC connection)
    问题 我目前正在构建一个 Spring MVC webapp,数据库是至关重要的后端部分。 但是,无论出于何种原因,Spring 都拒绝将数据处理为 UTF-8。 由于视图、资源和浏览器设置为 Unicode,数据库中的表也是如此(并且还阅读了很多类似的问题),我已经确定问题出在数据库连接上。 JDBC Driver 应该在 connectionProperties 中提供两项:useUnicode(设置为yes和 characterEncoding(设置为utf8 )。然而,事实证明这是不可能的。 JDBC 是一个 bean,因此通过 XML 文件进行配置,如下所示: <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/<database>" /> <property name="username" value="<not telling>" /> <property name="password" value="<not telling>" /> 此设置将从数据库中提取的所有非字母数字字符(例如箭头或希腊字母)转换为问号。 这显然是不可接受的。 我尝试了多种解决方案:将 JDBC URL
  • Cannot connect to Postgresql DB in Play framework
    Im trying to connect to the Postgresql using play frame work. I tried Everything but I still cant solve this problem db.default.user=user db.default.password=qwerty db.default.url="jdbc:postgresql://localhost:5432/paperclips" db.default.driver=org.postgresql.Driver but I get following error: Cannot connect to database [default] [error] c.j.b.h.AbstractConnectionHook - Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: java.net.ConnectException: Connection refused.Message:Connection refused. Check that the hostname and port are correct and that
  • 如何将 UCanAccess 连接到使用数据库密码加密的 Access 数据库?(How to connect UCanAccess to an Access database encrypted with a database password?)
    问题 我开发了一个带有 Access 数据库的 Java 应用程序(字典)来存储字典中的单词,我正准备分发它。 我想用密码加密我的数据库,以防止人们访问我的话。 当我设置密码时,Java 代码显示此异常 net.ucanaccess.jdbc.UcanaccessSQLException: Decoding not supported. Please choose a CodecProvider which supports reading the current database encoding. at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:247) 这是我使用密码加密数据库之前的连接代码.... String s1="jdbc:ucanaccess://"; String user=""; String pass=""; String s4="words.accdb"; public void connectToDB(){ //database connection try { conn = DriverManager.getConnection(s1+s4,user,pass); } catch (SQLException e) { e.printStackTrace(); }
  • Could not open client transport with JDBC Uri: jdbc:hive2://hadoop002:10000/default: java.net.Connec
    今天使用Dbeaver连接hive使用的好好的,然后突然连不上了。 Could not open client transport with JDBC Uri: jdbc:hive2://hadoop002:10000/default: java.net.ConnectException: Connection refused: connect java.net.ConnectException: Connection refused: connect java.net.ConnectException: Connection refused: connect Connection refused: connect Connection refused: connect 然后bin/hive也没办法登陆了(但是有错误提示) Cannot create directory /tmp/hive/gabriel/a07b07c1-2cfc-47db-aeb0-83c819507e3e. Name node is in safe mode. Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe
  • 无法在 Play 框架中连接到 Postgresql DB(Cannot connect to Postgresql DB in Play framework)
    问题 我正在尝试使用播放框架连接到 Postgresql。 我尝试了一切,但我仍然无法解决这个问题 db.default.user=user db.default.password=qwerty db.default.url="jdbc:postgresql://localhost:5432/paperclips" db.default.driver=org.postgresql.Driver 但我收到以下错误:无法连接到数据库 [默认] [error] c.j.b.h.AbstractConnectionHook - Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: java.net.ConnectException: Connection refused.Message:Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. [error] application - ! @6hmjgfh72 - Internal server error
  • 数据源derby-连接被拒绝(data sources derby - connection refused)
    问题 我正在尝试用Java项目连接数据库。 阅读了一些教程和课程支持后,我了解到我需要在管理控制台下创建一个新的数据源。 因此,我已经登录到管理控制台,然后导航至资源-> JDBC->数据源->新建; 填写字段,当我测试连接时,我得到的错误是这一个: 消息对于节点RO2CVG6CNode01上的服务器server1上的数据源MyDB,测试连接操作失败,但有以下异常:java.sql.SQLNonTransientException:java.net.ConnectException:在端口1527上连接到服务器localhost时出错,消息为拒绝连接:connect.DSRA0010E: SQL状态= 08001,错误代码= 40,000。 查看JVM日志以获取更多详细信息。 我不知道问题出在哪里。 也许数据库名称为:jdbc:derby:D:\ MyDB? 谁能帮我吗? 在本教程之后,我还尝试仅使用MyDB。 但是仍然不起作用。 回答1 您是否正在运行Derby Server? 您很有可能尝试在没有实际服务器在端口1527上运行的情况下连接到数据库。 您可以尝试使用命令行/ linux shell建立连接-取决于您使用的操作系统。 如果您喜欢,请尝试以下操作: 打开命令提示符导航到您的Derby安装目录导航到“ bin”目录(注意:如果存在
  • H2 数据库简介
    H2数据库 H2 是使用Java开发的内嵌式数据库,开源。支持内存、文件等多种模式。常用于开发和测试环境。 特性 读操作快, 写操作不如SQLite支持全文检索(提供了内置全文检索和Apache Luncene的全文检索)可以通过浏览器操作数据库 运行模式 Embedded Mode 内嵌模式Server Model 服务器模式混合模式 下载 目前最新版本是 1.4.200 , 于2019/10/14 发布。 Windows 安装版本: https://h2database.com/h2-setup-2019-10-14.exe解压版本, 适合Windows、Linux等操作系统: https://h2database.com/h2-2019-10-14.zip Maven依赖 <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.4.200</version> </dependency> Hibernate 在hibernate.cfg.xml 配置: <property name="dialect"> org.hibernate.dialect.H2Dialect </property> 使用 数据库连接地址 内嵌 jdbc:h2:~/test
  • Error:The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
    I am using Windows 7 Netbeans IDE 7.1.2 SQL Server Management Studio Express 2005 JDK1.6 I am getting the below error while connecting to the database: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect My connection string is: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection connection = DriverManager.getConnection( "jdbc:sqlserver://127.0.0.1:1433;databaseName=dbcm;" + "user=sa;password=sa"); I've checked below things: In SQL Server Configuration Manager, Protocols for
  • SocketIO ERR_CONNECTION_REFUSED(SocketIO ERR_CONNECTION_REFUSED)
    问题 我开始使用 NodeJS 和 Socket.IO。 我正在尝试使用 NodeJS http 服务器设置一个基本示例并建立到服务器的 Socket.IO 连接。 我也在使用 angular JS,基本上我想要的是当用户按下按钮时建立到服务器的连接。 但是,当我尝试时,我收到此错误 GET http://localhost/socket.io/?EIO=2&transport=polling&t=1404288173776-3 net::ERR_CONNECTION_REFUSED 这是我的代码: 服务器.js var http = require('http'); var server= http.createServer(handler); var io = require('socket.io')(server); server.listen(8080); function handler(req, res) { res.writeHead(200); res.end('Hello Http'); } io.on('connection', function (socket){ socket.emit('news', { hello: 'world' }); console.log('connected!'); }); 应用程序.js var app = angular