SQL Server jdbc driver not connect remote server - sql-server

I'm trying to connect to a SQL Server whose database installation was done using an instance. When I try to connect to the server using the microsoft driver (com.microsoft.sqlserver.jdbc.SQLServerDriver), it returns an error stating that it could not connect. Using the same driver but connecting to a local database, it connects successfully.
The error is not in the SQL Server TCP/IP configuration, because if I make the connection using the "net.sourceforge.jtds.jdbc.Driver" driver, the application connects to the database.
But I can't use the jtds driver, because I'm using JetBrains / Exposed and it requires the use of the microsoft driver. So I need to make it work with "com.microsoft.sqlserver.jdbc.SQLServerDriver"
URL when I try to connect on SQL Server
jdbc:sqlserver://SERVER1:1433;database=db_test;instanceName=SQL2016;loginTimeout=5;
Error message
org.jetbrains.exposed.exceptions.ExposedSQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Falha na conexão TCP/IP com o host ITALIA, porta 1433. Erro: "connect timed out. Verifique as propriedades da conexão. Verifique se uma instância do SQL Server está sendo executada no host e se está aceitando conexões TCP/IP na porta. Verifique se as conexões TCP na porta não foram bloqueadas por um firewall.".
SQL: [SELECT 1 AS Test]
at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed(Statement.kt:48)
at org.jetbrains.exposed.sql.Transaction.exec(Transaction.kt:128)
URL when I connect a local server successfully
jdbc:sqlserver://localhost:1433;database=db_test;loginTimeout=20;
URL when I connect successfully using jtds driver
jdbc:jtds:sqlserver://SERVER1:1433/db_test;instance=SQL2016;loginTimeout=30

Related

Pentaho error: The Network Adapter could not establish the connection (connection to an oracle database)

I've been having an IO error that doesn't allow me to connect to an oracle database
Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
Erro de ES: The Network Adapter could not establish the connection
Any guess? how can i resolve this issue?
I tried to connect the oracle database with other data tools like power bi and it was successful, i have no idea why it is happening

Can't use OData with SQL Server 2016 (DTExec 13)

I've build a simple package that extract data from an OData source.
It work with DTExec 12 (SQL Server 2014) but when I deploy to an SQL Server 2016 (DTExec 13) I got a weird error in french :
La connexion « Connexion » est introuvable. Vérifier que le gestionnaire de connexions renferme une connexion de ce nom.
Lousy translate in English it mean :
The connection "connexion" is not found. Check if the connections managers has a connection with this name.
I have no connection named connexion in my package.
Do you have any ideas how I could investigate this error ? How can I look at the available connections in the connection managers ?
I feel like there is no OData connector installed for SQL Server 2016 but there is an old one that was installed with SQL Server 2014 because DTExec 12 work on the same server with the same package.

connect arduino uno to local server

I am working on a project for which I am using MS SQL server and using Windows authentication. I have made the database and HTML page both are connected.
Now I have to connect Arduino to my local server because I want to store the data coming from my sonar sensor into Arduino UNO to my database tables and show it on HTML page.
Arduino is on robot car and database is in my laptop I have to connect them remotely.
I know how to connect Arduino to web server but don't know how to connect to my local server. Arduino command to connect to server is client.connect(ip,port) or client.connect(url,port). But I don't know my IP. My local host server URL is localhost:30154\Home.
Guide me how can i connect my Arduino UNO to my database.
localhost = 127.0.0.1
You can use ipconfig in Prompt to check the v4 protocol, which is your ip, but the problem is if the ip is not fixed.
Você pode usar o ipconfig no Prompt para verificar o protocolo v4, qual é o seu ip, mas o problema é se o o ip não for fixo.

Execute a job in SQL Server Agent : login from an untrusted domain

I have an issue with the execution of an SSIS Package within the SQL Server Agent.
Context :
I deployed a package into the Integrated Services Catalog : http://i.stack.imgur.com/m9Y9c.png I have not difficult to execute this package manually.
Problem :
When I try to execute this package within a job into the SQL Server Agent, I have an error : "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
Exécuté en tant qu'utilisateur : NT Service\SQLSERVERAGENT. Utilitaire d'exécution de package Microsoft (R) SQL Server Version 11.0.5058.0 for 64-bit
Échec de l'exécution du package serveur IS en raison de l'erreur 0x80131904. Serveur : OPP41****** Chemin du package : \SSISDB\automates\automate_PIT_pilotage\recuperation_cmd_a_traiter.dtsx
ID de référence environnementale : NULL. Description : Échec de la connexion. La connexion provient d'un domaine non approuvé et ne peut pas être utilisée avec l'authentification Windows. Source : .Net SqlClient Data Provider
The owner of the job is my AD account.
This is how the step is configured : http://i.stack.imgur.com/QrJf9.png
The SQL Server Agent service is running through the "NT Service\SQLSERVERAGENT" account.
Thank you very much by advance, I'm going crazy !
Create credentials: Security -> Credentials
Create a proxy account: SQL Server Agent -> Proxies -> SSIS Package Execution
Set SSIS package to run as proxy account.
Take a look at article.
I had found that my Job was executing against a DNS name and not the SQL Server Name. So check your SQL server name : select ##servername and make sure you use this name in referring to the SQL server where the catalog is located and not some or other DNS name. I have found that it will also succeed using the DNS name to call the packaged from a different SQL server, but if the job runs on the local SQL server calling a package on the same SQL server then the server name must refer to the value in ##Servername.

Cannot connect to my database from within SQL Management Studio

The instance is running, but I still cannot connect, I get this error:
TITLE: Connect to Server
------------------------------
Cannot connect to PC-CARLA\SQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
Error relacionado con la red o específico de la instancia mientras se establecía una conexión con el servidor SQL Server. No se encontró el servidor o éste no estaba accesible. Compruebe que el nombre de la instancia es correcto y que SQL Server está configurado para admitir conexiones remotas. (provider: Interfaces de red SQL, error: 26 - Error al buscar el servidor o instancia especificado) (Microsoft SQL Server, Error: -1)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
Any suggestions on what can be going wrong? Why doesn't this thing connect? :S
How do I find the instance NAME of a server? Why doesn't this work?
You need to enable the correct protocol(s) in your SQL Server Configuration Manager.
It is the second option in the screenshot you provided ("SQL Server Network Configuration").
You need to enable the protocols you need (all of them to make sure?) and then you need to restart the SQLEXPRESS service.
I don't speak whatever language that error message is in, but I'm guessing that it's similar to one that I've seen in a language that I do know. I think it's saying that the target machine may not be configured for remote connections. Whenever I see that, there's either a firewall between the host and client, the specific instance is down, or there is a problem with the SQL browser. As a test, can you telnet to the port that the SQL server is configured to run on?
Ben Thul is correct. You are getting this problem because the SQL Browser service is stopped.
By default (when using the full version of SQL Server but not SQL Express), SQL Server starts up and listens for connections on TCP port 1433. When you connect from SQL Management Studio (or your application) and don't specify a port, it tries to connect using 1433.
However - this is different for SQL Server Express (and other named instances of SQL Server). These start on a dynamic port and rely on the SQL Browser Service (UDP/1434) to provide the mapping between instance name and port.
So, in your example - you try and connect to ServerName\SQLEXPRESS. As it's not the default instance a connection is attempted to the SQL Browser service, which would then respond with the dynamic port of SQL Express (say port 12345). Finally, your SQL client will connect to ServerName port 12345 and will find your named instance.
In short - enable the browser service!

Resources