I have an application on Play Framework 2.3, and connecting to SQL Server (2008, 2012 and 2014 versions). Configuration looks like this:
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.default.url="jdbc:sqlserver://192.168.100.101;databaseName=myDatabase;SelectMethod=direct;autoReconnect=true"
That works propperly except for application starting before starting SQL Server. In that case play generates an error:
Configuration error[Cannot connect to database [default]]
Is, that possible, to set PlayFramework automaticly reconnect, after that error, when Play arrives a new request, and how can I do that?
HikariCP has a property to do exactly what you want:
initializationFailFast: This property controls whether the pool will "fail fast" if the pool cannot be seeded with initial connections successfully. If you want your application to start even when the database is down/unavailable, set this property to false. Default: true
You can use play-hikaricp module to replace the default pool (BoneCP) and then configure HikariCP as explained above.
Related
I get above error while trying to connect oracle 12c. I try using ojdbc6 and ojdbc7 jar files. I found below comment
------------------->
Bug 14575666
In 12.1, the default value for the SQLNET.ALLOWED_LOGON_VERSION parameter has been updated to 11. This means that database clients using pre-11g JDBC thin drivers cannot authenticate to 12.1 database servers unless theSQLNET.ALLOWED_LOGON_VERSION parameter is set to the old default of 8.
This will cause a 10.2.0.5 Oracle RAC database creation using DBCA to fail with the ORA-28040: No matching authentication protocol error in 12.1 Oracle ASM and Oracle Grid Infrastructure environments.
Workaround: Set SQLNET.ALLOWED_LOGON_VERSION=8 in the oracle/network/admin/sqlnet.ora file.
<-------------------
I have one dought to implement above workaround as we have shared database.
If I set SQLNET.ALLOWED_LOGON_VERSION=8 in the oracle/network/admin/sqlnet.ora file will it affect other users ?
Will it affect shared applications and its functionality ?
Setting SQLNET.ALLOWED_LOGON_VERSION=8 in sqlnet.ora affects all connections to the server. You're allowing user authentication with older versions of the password verifier and it affects all users. You can't allow it for just one user. But this isn't going to break other applications that can already connect successfully. It will allow older applications (that use old drivers) to connect too. The best solution is to upgrade all clients if possible but this setting is the workaround and it was made available for this exact purpose.
I am writing an Elixir project that connects to a Postgres database via Ecto. The database server is on a different server from the application itself, and is more subject to outages that would not affect the Elixir project than if they were running on the same hardware.
When the application starts normally, the database connection seems to be made automatically, and everything works fine. But if there is a connection error, Ecto simply spews any errors into the log.
What I would like to do is detect the current connection status, and report that information via a simple Plug route to an external load balancer, such that traffic can be routed to a separate server with an active connection.
The trouble is, I'm unsure how to determine if Ecto has a viable connection to the database, apart from listening to the log, which doesn't then report that the database connection has been restored.
What can I call to determine if an Ecto connection is live and usable, preferably without making no-op queries against that connection?
Ecto simply spews any errors into the log.
This is the default strategy with enabled backoff for the connection. You can disable the backoff by setting backoff_type to :stop in repo options and deal with errors by yourself.
What can I call to determine if an Ecto connection is live and usable, preferably without making no-op queries against that connection?
I think you can check if the connection "usable" only by using it :)
try do
Ecto.Adapters.SQL.query(MyApp.Repo, "SELECT 1")
rescue
e in DBConnection.ConnectionError -> :down
end
BTW, the module mentioned above is the default pool module for the connection you can rely on its internals(don't) and do the checkout manually. Own pool can be implemented instead of this one :)
To detect whether a connection to the database is live and usable, you can try connecting to it directly outside of Ecto using :gen_tcp.connect/3. The code could look something like this:
case :gen_tcp.connect('127.0.0.1', 5432, []) do
{:ok, _} ->
# code for handling ok scenario
{:error, error} ->
# code for handling error scenario. Typically, you'll get the econnrefused error when the server is down
end
Note that Ecto gets the details of the server to connect to through the Mix config you set for it. If you want to change the server it connects to, you'll have to run Application.put_env/4 and then restart the Ecto repository for Ecto to recognize the new config. For example:
Application.put_env(:my_app, MyApp.Repo, [adapter: Ecto.Adapters.Postgres, username: "postgres", password: "postgres",database: "new_db", hostname: "different_host.com", pool_size: 20])
Supervisor.stop(MyApp.Repo)
I'm using the AWS Toolkit in Visual Studio 2013 to attempt to launch a new instance on Amazon RDS. I get through the wizard for creating the new instance and after clicking finish, there is a delay, and then a message appears saying:
Error launching DB instance: DB Security Groups can only be associated with VPC DB Instances using API version 2012-01-15 through 2012-09-17.
Launching different types of instances (SQL Server SE vs MySQL) doesn't seem to help, nor does selecting different versions of the platforms (SQL Server 2008 vs 2012). The only thing that gets it to go through is unchecking the box for "default" in the DB Security Groups area. However, I feel like something is going on here that shouldn't be happening.
Can anyone explain why this is happening and how I can resolve it other than by not setting a default security group? Thank you.
If you created your AWS account recently, you will be using a VPC by default.
It sounds like the API the plugin is trying to use hasn't been updated. The latest version is 1.5.6, and looking at the history it seems like some of these features were added in 1.5.0.
I finally solved it! Since I couldn't use the API that the VS 2013 plugin uses, I had to manually add my IP to the Security Group created for my Elastic Beanstalk.
Go to the console, ec2's security groups configuration
Find the one which description matches your Beanstalk (e.g.: Security Group created for Beanstalk Environment to give access to RDS instances)
Hit Inbound, Edit and add a new rule for All Traffic (I guess HTTP should be enough, but just in case).
In Source, select My IP and Save.
I need to modify an existing Windows CE app which gets it data from SQL Compact database (sdf) to update the database table (only 1 table) with latest records from a SQL Server Express when ever it is docked to the machine.
I came across Microsoft Sync Framework and it seems to be more than capable of enabling me to achieve my requirement. I tried one of their Walkthrough: Creating an Occasionally Connected Smart Device Application, but was not able to get the app working (the app I created based on the guide as well the sample code). The WCF service is hosted successfully and I can browse to the service from the browser as well.
I am encountering an error at the below line on the click event of SynchronizeMenuItem.
Dim syncStats As Global.Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()
Below is the trace from the output window:
'MobileSyncServices.exe' (Managed): Loaded 'System.SR.dll'
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
The thread 0x771e2c1e has exited with code 0 (0x0).
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
I've been trying to find a solution for this problem as I didn't come across any after 2 days hence posting it here. I've installed all the framework/ service pack which are prerequisite for this as well. Have any of you tried this walk through and encountered a similar issue? What baffles me further is, that the sample code is also failing in two of my development machines (1 is Win XP and the Win 7).
Is there any other alternative way to update table in a Windows CE device with SQL Express Server when docked?
The requirment was to find a method to overwrite an table on a docked device (connected through ActiveSync/ Sync Center), achieved this by connecting to the SQL Server directly (by specifying either ip address) from the Pocket PC.
User would specify the SQL Server credentials Under system config/ options, which would be made use of to connect to the SQL Server. Once the desired data from the Server is broght down, the compact database is updated with the relevant data.
Below web resources paved the way to solve this issue and achieve the goal.
Connecting to SQL Server Express from a Pocket PC application
Accessing SQL Server Express from the emulator (or PDA)
I have a Delphi Application that is connected to a SQL Server db using SDAC component from DevArt, we have 200 installations of the software and only to a customer, with some users, I notice the following error:
"Connection is busy with results for another command" = "La connessione รจ occupata dai risultati di un altro comando".
SQL vers.: SQL Server 2008 R2 Express with filestream full enabled
My application create both db users and SQL account logins:
creating a new user, then there aren't problems
changing user code in my application, it means that another db user and SQL account login is created, I have the error
this problem happens only with some users, not all ones
What I've already tried without luck:
deleted and re-installed database
uninstalled and re-installed SQL Server Instance
checked users/account properties in SQL Server (all ok)
If you need specific infos please tell me
------------NEW INFORMATIONS------------
I checked better all the Instance properties from Studio Management and I've noticed that CPU's are not checked (see image below).
Instead in all the other normal installations of SQL Server, I see filled checkboxes.
Could it be the problem?
I hope this help you to help me...
The "Connection is busy with results for another command" error means that there are at least two queries that use the same connection. This problem can occur if you are using one connection in several threads. To solve the problem in this case, you should have connection (the TMSConnection component) in each thread.
Also, this problem can occur if you set the TCustomMSDataSet.FetchAll property to False. When FetchAll=False, execution of such queries blocks the current session. In order to avoid blocking OLEDB creates additional session that can cause the "Connection is busy with results for another command" error. To solve the problem in this case, you should set the TMSConnection.Options.MultipleActiveResultSets property to True. The MultipleActiveResultSets property enables support for the SQL Server Multiple Active Result Sets (MARS) technology. It allows applications to have more than one pending request per connection, and, in particular, to have more than one active default result set per connection. Please note that the MultipleActiveResultSets property works only when SQL Native Client is used. Therefore, you should also set the TMSConnection.Options.Provider property to prNativeClient.
Just wanted to correct dataol's answer and say that MARS_Connection should be set to "Yes" instead of "True" to enable Multiple Active Result Sets. At least on SQL Server 2012 if you are using a DSN file:
[ODBC]
DRIVER=SQL Server Native Client 11.0
DATABASE=MYDBNAME
WSID=
Trusted_Connection=Yes
SERVER=
MARS_Connection=Yes
To provide Multiple Active Result Set (MARS) support to a SQL connection using the MSSQL driver, you must add a key called Mars_Connection and set its value to True.
#ienax_ridens, I recently encountered the same problem using the same tools (Delphi and Devart-SDAC).
In my case one specific query giving two results sets.
My TMSQuery was
If Condition= 1
begin
Select * from #TempTable1
end else
begin
-- Some more stuff
Insert INTO #TempTable2
--
--
End
Select * from TempTable1 -- here is the problem
so in case of Condition = 1 it was giving two results sets and causing "Connection is busy with results for another command"
I hope this helps you.
Edit: I realized you post is quite old, please share what you did to resolve this error
I had the same problem and solved installing the microsoft odbc driver 11 (msodbcsql) (https://www.microsoft.com/pt-br/download/confirmation.aspx?id=36434).
Check your compatibility mode i just ran into this when we moved from 2008 to 2016 db we had to set it to 2012 compatibility mode.
I had this problem when I found that my runtime DLL was in the environment path and the program folder. It was a runtime issue and nothing with the program.