Cannot connect to any SQL Server database. java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: localhost
Using the SQL Server driver (have tried several different versions). Made sure my java was up to date. Keep getting this error output. Any ideas what is going on? Thanks!
WARN - lij.database.util.ErrorHandler - java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
java.util.concurrent.CompletionException: java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:343)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at com.intellij.util.ExceptionUtil.rethrowAllAsUnchecked(ExceptionUtil.java:186)
at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.createInner(DatabaseConnectionManager.java:346)
at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.lambda$sync$2(DatabaseConnectionManager.java:300)
at com.intellij.database.dataSource.AsyncUtil.withAsyncFriendly(AsyncUtil.java:163)
at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.sync(DatabaseConnectionManager.java:297)
at com.intellij.database.dataSource.DatabaseConnectionManager$Builder.sync(DatabaseConnectionManager.java:111)
at com.intellij.database.dataSource.DataSourceSyncManager.lambda$static$1(DataSourceSyncManager.java:39)
at com.intellij.database.dataSource.DataSourceSyncManager$SyncProcessor$1.perform(DataSourceSyncManager.java:240)
at com.intellij.database.dataSource.DatabaseModelLoader$IntrospectionSession.updateDatabaseInfo(DatabaseModelLoader.java:288)
at com.intellij.database.dataSource.DatabaseModelLoader$IntrospectionSession.run(DatabaseModelLoader.java:271)
at com.intellij.database.dataSource.DataSourceSyncManager$SyncProcessor.performSync(DataSourceSyncManager.java:242)
at com.intellij.database.dataSource.AsyncUtil.lambda$null$6(AsyncUtil.java:54)
at com.intellij.database.dataSource.AsyncUtil.lambda$underProgress$12(AsyncUtil.java:131)
at com.intellij.database.dataSource.AsyncUtil.lambda$underProgress$13(AsyncUtil.java:137)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:548)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:137)
at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:131)
at com.intellij.database.dataSource.AsyncUtil.lambda$captureIndicator$7(AsyncUtil.java:54)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
... 6 more
Caused by: java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused (Connection refused)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:342)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at com.intellij.execution.rmi.RemoteProcessSupport.b(RemoteProcessSupport.java:257)
at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:232)
at com.intellij.execution.rmi.RemoteProcessSupport.a(RemoteProcessSupport.java:255)
at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:161)
at com.intellij.database.console.JdbcDriverManagerImpl.getDriver(JdbcDriverManagerImpl.java:117)
at com.intellij.database.dataSource.DatabaseConnectionEstablisher.lambda$establishConnection$1(DatabaseConnectionEstablisher.java:56)
at com.intellij.database.dataSource.AsyncUtil.lambda$null$4(AsyncUtil.java:48)
at com.intellij.database.dataSource.AsyncUtil.lambda$underProgress$12(AsyncUtil.java:131)
at com.intellij.database.dataSource.AsyncUtil.lambda$underProgress$13(AsyncUtil.java:137)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:500)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:137)
at com.intellij.database.dataSource.AsyncUtil.underProgress(AsyncUtil.java:131)
at com.intellij.database.dataSource.AsyncUtil.lambda$captureIndicator$5(AsyncUtil.java:48)
at java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981)
at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2124)
at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:110)
at com.intellij.database.dataSource.DatabaseConnectionEstablisher.establishConnection(DatabaseConnectionEstablisher.java:53)
at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.supplyAsync(DatabaseConnectionManager.java:380)
at com.intellij.database.dataSource.DatabaseConnectionManager$Executor.createInner(DatabaseConnectionManager.java:320)
... 25 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:148)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 49 more
请先登录再写评论。
Hi,
You can't connect to localhost instance of your SQL server.
Are you trying to connect to a local instance?
Could you provide your data source connection settings, DataGrip version and driver you use?
Thank you.
I am trying to connect to a local instance in this case, but I get the exact same errors trying to connect to remote instances. I can also access my local instance from other SQL Server management tools (i.e. Navicat, Visual Studio Code, etc).
Datagrip version:
DataGrip 2017.2.1
Build #DB-172.3757.39, built on August 9, 2017
Licensed to DataGrip Evaluator
Expiration date: September 14, 2017
JRE: 1.8.0_152-release-915-b10 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.5
SQL Server driver class:
com.microsoft.sqlserver.jdbc.SQLServerDriver
SQL Server driver version:
6.0.8112.100
Here's a screen shot of my connection settings (nothing crazy going on):
bump
Hi,
Look through https://blog.jetbrains.com/datagrip/2016/06/21/connecting-datagrip-to-ms-sql-server/
Thank you.
It turns out that this doesn't have anything to do with MSSQL in particular. I get the same error anytime I try to connect to any type of database (MYSQL, etc). It seems to me like there's something wrong with the the JVM settings or environment. Any thoughts or suggestions?
@Ben
Hi,
Could you provide full IDE logs in archive?
Thank you.