Azure cloud service hosted website stops connecting database suddenly - sql

I have a website hosted on azure cloud services. The configuration is - Java 7, Tomcat 7, SQL Azure. Nowadays I am running into a problem. Suddenly, my website stops responding to pages which require database connectivity. I have used Apache Commons DBCP for connection pooling. I have checked all the logs but I could not find any connection failure logs. I have checked the DB connections on azure portal, which also looks okay to me. Please help me out on this and let me know what other information is required.
here is sql connection configuration-
min connections - 20
max connections 200
num helpers - 10

Related

Connecting SQL Server To Cognos Free Trial Version

I had subscribed for free trial for IBM Cognos. In that I have to connect my SQL server with it. I had tried all alternatives but none is working. According to the error, I had even given access of firewall through my system with port defined, also in sql server configuration manager. But still facing the same error when Testing the connection through ibm cognos.By default, we can only connect through jdbc.
Error
Connection In cognos
SQL Server configuration manager
Port Setting Inbound Firewall
The MSSQL database you are connecting to would not be local to the on demand server, so a host of localhost is likely not correct.
If the MSSQL is not publicly accessible you will need to use a secure gateway connection. https://www.ibm.com/docs/kk/cognos-analytics/11.1.0?topic=demand-secure-gateway-only
Additionally, public or private you will also need to add the following to the JDBC connection URL TrustServerCertificate=true

Why can't my Azure app service backup connect to my Azure SQL database?

I am experiencing a problem configuring the backup of an SQL database using Azure.
I have web application and an associated Azure SQL database. The app connects to the DB no problem. I have pasted the connection string provided to me by the Azure UI (Home -> SQL Databases -> My SQL Database) into the connection strings section of the configuration for the App Service (Home -> App Services -> My App Service -> Configuration). I created a backup of the App Service (Home -> App Services -> My App Service -> Backups -> Configuration) and ticked my connection string to be back up my database.
After about 20 minutes, the backup fails with the 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: TCP Provider, error: 0 - No such host is known.)
I can connect to the database from the SQL Server Management Studio running on my laptop, and from code running on my laptop, using the server, username and password from the connection string, why can the backup not connect to the database?
Many thanks for any advice.
Linking the same question asked on MSDN: Azure SQL Database Backup Fails, cannot connect to the database.
Please see the Requirements and Restrictions details where this functionality is not supported, which I have listed below the applicable items that apply to your scenario:
The Backup and Restore feature requires the App Service plan to be in the Standard tier or Premium tier. For more information about scaling your App Service plan to use a higher tier, see Scale up an app in Azure. Premium tier allows a greater number of daily back ups than Standard tier.
You need an Azure storage account and container in the same subscription as the app that you want to back up. For more information on Azure storage accounts, see Azure storage account overview.
Backups can be up to 10 GB of app and database content. If the backup size exceeds this limit, you get an error.
Using a firewall enabled storage account as the destination for your backups is not supported. If a backup is configured, you will get failed backups.
If none of the above apply to you, then the issue is an IP Address issue in that you need to enable "Allow access to Azure services" in the firewall for your Azure SQL (logical) Server.
Additional troubleshooting can be performed by leveraging Application Insights to capture the backup failure event and then drill into the collected log detail to see what the specific error is.

Can't interact with database when published to azure

Below is the steps i have took to publish my Website to Azure. I have two data connections the "defaultconnection" for users tables log in register etc. The other is a connection to an Azure Sql Database.
On Azure i created a new app service.
In Visual Studio i click on project and select publish.
In the publish Web window that pops up i select Microsoft Azure Web Apps.
In the following window i select the app service i created in Azure.
In the settings window it shows the two connection database connections.
They both have the same connection string which is the Azure hosted Database. I am not sure what to change the connection string to for the users table. I created a SQL database in azure and connected that to the app service then used that connection string for the "defaultconnection". The string is below
Server=tcp:userauthen.database.windows.net,1433;Data Source=userauthen.database.windows.net;Initial Catalog=USERAUTH;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
I published to azure and am able to go through the pages but as soon as i try to interact with the database i get an internal server error 500.
I tried publishing the website without userlogin so i could see if it connected to the Azure sql database but i still get the internal server error 500. I am really stuck at this point and any assistance would be helpful.
So i changed the firewall settings to allow certain IP address and it worked. I can access both my databases.

MSSQL wont accept connection from website on other host

Iam using SQL server 2000 SP4 and iam running a website on localhost.
This worked great, i moved to hostgator to run my websites there.
I changed the IP in inc.config.php but i still get an error when i visit my website.
Core-Error: Failed to connect to database!
Error: Please check if MSSQL-service is running and reachable (firewall, etc.).
I added firewall rules for the ports that are needed and also added sqlserv.exe to the firewall to allow this. The service is up because my client can still connect to my local hosted website.
Do i need to enable remote connection from MSSQL 2000 ?
http://webtest.demoniz.com

Unable to Connect to SQL Server 2005 Db From Vista x64 Windows Service

I'm trying to connect to a remote SQL Server 2005 db from a .NET Windows service running in Vista Home Premium x64. I can access the remote db from a console app with no problem. I can connect to a local db from the Windows service with no problem. I was able to connect from a service from XP with no problem. There's no firewall or anti-virus running. How do I configure this service to be able to connect to the remote db?
I've tried to connect by running the Windows service as a local admin account, LocalSystem, LocalService, and NetworkService.
The connection string:
Data source=SERVER_NAME;Initial Catalog=DB_NAME;Integrated Security=True;
The 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)
MORE INFO:
I have also tried to connect using SQL Server authentication with no success:
Data Source=SERVER_NAME;User ID=USER_ID;Password=PWD;Initial Catalog=DB_NAME
This connection string works from the console app too.
MORE INFO:
I ran Process Monitor for the Windows Service and the console app. The Windows service showed \SERVER_NAME\pipe\sql\query was ACCESS DENIED but the console app showed SUCCESS when reading/writing files to \SERVER_NAME\pipe\sql\query.
Good Lord! Why all the gibberish and complex responses on this site. Create a User Account
Either local or Domain and set the service to use that account. Then go into your SQL Server and Add you new account to the Database and set permissions. Voila!
Oh yeah, dont plague yourself with SQL Authentication. Integrated Security is much easier to maintain and without a password in your web.config your much safer.
1) open a command prompt. Type "ping SERVER_NAME". Does it respond? You may have a DNS or connectivity issue if this doesn't work.
2) "telnet SERVER_NAME 1443". Do you see anything or does it refuse your connection? This will definitively tell you whether or not someone is listening on the other end.
3) Go into SQL Server Management Studio. Right click Properties of your server. Select "Connections" from the left side. Is "Allow Remote Connections" checked?
4) Since you're running using network service/system, you will need to make sure you have a login configured on your server for the machine account DOMAIN\CLIENTSYSTEMNAME$. Note the $ sign. This is your machine account, and this will be the user that SQL Server will see.