I have a batch that takes dump (using mysqldump) of my DB that is about 250G in size. This dump runs fine till a new connection is established. Now this new connections leads to loss of existing connection that takes the dump of DB. This happens almost consistently excepting some times when this error or loss of connection does not occur. First connection is done using hostname of localhost and second one is connected using static IP address of the box.
Error log below..
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `test_table` at row: 2549201
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) when trying to connect
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
New connection does a select * from test_table (done using resultSet.setFetchSize(Integer.MIN_VALUE)) from a table in a streaming fashion. That is the new connection also establishes a long term connection which fetches records one after one. This new query also runs for a long time.
Related
I'm trying to create a SSAS Project and deploy to a remote server.
The Data Source is a Database in the same server, but the project must be made in my laptop.
The remote server is not in a domain environment, so to login in SSAS, I used runas /netonly mothod using Server's Administrator Account, which works fine to connect to SSAS Server through SSMS.
I created SSAS Project using Workspace Server and connection is successful.
I am also able to connect to same Server using SQL Server Database Data Source, using Impersonate Service Account, but after I select the tables I need, the processing fails and gives me this Error:
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.).
And as result I get all tables without data, just column names.
If I create a project using Integrated Workspace, I am able to get Data from Source, but the same Error occurs when I try to Deploy the Project. The metadata deploys successfully, but all processing fails with the same Error.
I tried to Increase Timeout, but the same thing happens even after waiting 30 minutes.
This process does not fail if I create and execute the project inside the Server.
Enable the TCP/IP in both Server NetWork and Client protocols;
Set TCP port:1433;
And then try it again.
Please reference this: troubleshoot-connecting-to-the-sql-server-database-engine
I need to connect Jmeter to my local MS SQL Server database. Everything works fine, when I'm working with remote databases, but when it comes to local databeses I get stuck at the beginning.
I've tried these settings to connect to my DB:
Database URL: jdbc:sqlserver://DESKTOP-IEK3G1S\SQLEXPRESS;DatabaseName=TestBase
JDBC Driver class : com.mircrosoft.sqlserver.jdbc.SQLServerDriver
And this is what i get:
Response message: java.sql.SQLException:
Cannot create PoolableConnectionFactory (The connection to the host DESKTOP-IEK3G1S, named instance sqlexpress has failed.
Error: "java.net.SocketTimeoutException:
Receive timed out". Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host.)```
Well, I had to recreate my SQL Browser connection and manually shutdown everything that was turned on in my Firewall options and everything has started working.
Enable TCP/IP in the SQL server configuration:
Enable IP address and set the desired TCP port for the connection:
SQL Server default TCP port is 1433, most probably you should be using 1433 in your JDBC Connection Configuration setup
Enable SQL Server Authentication mode or add Integrated Security = true to your JDBC URL if you plan to connect with your current credentials (you will need to have sqljdbc_auth.dll file under Java Library Path)
Make sure to use matching SQL Server JDBC Driver
Change "Validation Query" to be select 1
I have successfully connected "Mrth Connect 3.5" with an Azure DB. But when i try to create and save a channel i`m getting an internal server error as below from Mirth.
Below is the Mirth Connect Server Manager database settings and connection string. I`m confident that this connection string is correct as Mirth Connect Server Manager turns to orange in color when i try connect to the Azure DB using these settings. So what might be causing the error.
jdbc:jtds:sqlserver://**.database.windows.net;DatabaseName=**
I have tried the above method couple of times. I did not work for me either. The best way usually everyone prefers is to leave the default mirth settings as it is in the server manager, so your screen will look like below
Inside the Mirth you can create channels and from the channel you can establish the connection to the databases as you like. This method will definitely work. I have tried connecting mydatabase established in AWS server it was working for me. Make sure you open the default port of MSSQL (1433). In case you create a new user and assign the database your port number may change. In that case you this below query in SQL server
USE master GO xp_readerrorlog 0, 1, N’Server is listening on’ GO
To identify the port number in which the database is running, and open that specific port in your cloud system.
Follow this to learn more about the connection string and DB reader in Mirth https://hl7engine.wordpress.com/2017/08/21/mirth-db-reader/
I have a VB.NET app that connects to a SQL Server.
We recently added database mirroring in case of a server failure.
Well of course, our SQL Server failed but the VB.NET app is not failing over.
I found that in our code, a failover partner wasn't specified in the connection string so I updated the connection string as follows:
sConnectionString = "Data Source=PROD-SQL;Failover Partner=FAILOVER-SQL;Initial Catalog=DB;User ID=****;Password=******;"
The SqlClient.SqlConnection object accepts this connection string but when I call its .Open() command it fails with the following error:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
Why is this? Our intranet apps failed over just fine (Classic ASP using DSN-less connections).
Does the application have to make at least one successful initial connection to the primary server before it can failover successfully?
Thanks!
Run this on your principal db
SELECT DB_NAME(database_id) AS 'DatabaseName'
, mirroring_role_desc
, mirroring_safety_level_desc
, mirroring_state_desc
, mirroring_partner_instance
FROM
sys.database_mirroring WHERE mirroring_guid IS NOT NULL;
The value returned in mirroring_partner_instance is the server name that will be used by your connection for failover, not FAILOVER-SQL. FAILOVER-SQL will be used when it first tries to get a connection but cannot contact PROD-SQL. If PROD-SQL is available the failover partner will be set in cache from the sql server value mirroring_partner_instance.
See here for more info: http://blogs.msdn.com/b/spike/archive/2010/12/15/running-a-database-mirror-setup-with-the-sqlbrowser-service-off-may-produce-unexpected-results.aspx
I'm connecting to a remote sql server instance with the following connection string
"Network Library=DBMSSOCN;Data Source=xx.xxx.x.xxx,1433;Initial Catalog=MyDatabase;User Id=MyUserId;Password=MyPassword;Connect Timeout=120;"
Sql Server Browser is running
Local and remote connections are allowed using TCP/IP only
The application randomly fails to connect citing the following SqlException
TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Code to connect as follows
using (SqlConnection connection = new SqlConnection(m_ConnectionString))
{
connection.Open(); // falls over here
}
I thought about Firewall config on port 1433 but why would the Firewall sometimes permit connections and sometimes not?
Is Sql Server Agent required to be running? And if so why as the description of Sql Server Agent on MSDN is not obvious in this respect?
Thanks!
EDIT: Tried adding an explicit rule on the Firewall to open up 1433 and so far so good, but could be randomness again so hard to say if I fix or not yet
No, SQL Server Agent does not need to be running. SQL Server agent is only needed to execute scheduled tasks on the SQL server.
This is probably a network issue. Can you ping the server? If so, try to ping it continuously with /t and see if all packets arrive.
It could also be a problem with the SQL server load. Is the server idle or under load?
Could you test the application locally on the SQL server or on the same LAN to see if the problem persists?
Well you don't need SQL Server Agent running now, the error suggest you are getting a timeout from the scenario.
There are various reasons why you may be blocked. Perhaps the firewall is configured to allow only a certain number of connections at a port at one time. Or the database itself is limiting the number of connections. Your internet is slow and you are hitting the 120 seconds timeout. The list goes on. :)
Your SQL Server database is going to sleep. The first time you try to connect to it, it has to restart and your connection times out.
Make sure the option "Auto Close" is set to "False". This prevents it from shutting itself down after the last connection is closed.
http://itknowledgeexchange.techtarget.com/sql-server/auto-close-is-almost-as-bad-as-auto-grow/