Configure HikariDataSource with Mssql properties connectRetryCount and connectRetryInterval - sql-server

I have used HikariCP for connection pooling, so the hikari will try to connection database for around 2min as configure timeout but I also want that connection object given by hikari
also use mssql ConnectRetryCount and ConnectRetryInterval property so that connection object will also try to connect for serval time if connection is fail.
Please suggest me how can do this or let me know if I am doing anything wrong.
HikariDataSource hikariDataSource = DataSourceBuilder.create()
.driverClassName(driver)
.url(url)
.username(user)
.password(password)
.type(HikariDataSource.class).build();
hikariDataSource.setMaximumPoolSize(2);
hikariDataSource.setConnectionTimeout(120000);
hikariDataSource.setValidationTimeout(120000);
Driver Name : com.microsoft.sqlserver.jdbc.SQLServerDriver
URL : jdbc:sqlserver://localhost:1501;DatabaseName=feature57;ConnectRetryCount=4;ConnectRetryInterval=50

Related

MSSQL connection String:

I'm trying to create scaledobject in keda and I'm referring the official keda documentation for this with MSSQL scaler.
While configuring connectionstring in this format "Server=example.database.windows.net;Port=1433;Database=AdventureWorks;Persist Security Info=False;User ID=user1;Password=Password#1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" , Is the server to be configured is same as hostname?
Basically, whether the host parameter that we specify in connection parameters explicitly is the same as the Server parameter in ADO format: ?
Can someone please help me here? After deploying my scaled object in keda with MSSQL trigger(I'm considering server name is same as host instance and configured like that) , I'm getting ready and active status as unknown.. In logs I'm only seeing that it's trying to create a HPA and then nothing happens. I guess the operator is getting stuck here. Please guide me on how to proceed to establish connection with MSSQL
As per the docs you either have to specify the connection string OR host: keda.sh/docs/latest/scalers/mssql

DBNavigator - Connection Error - Unrecognised Session Property - 'v$session.program' in PyCharm

I am trying to connect the to the presto data store using presto driver.
When I try to test connection, it fails with error
To isolate if it was connection configuration issue, I tried connecting with DBeaver, and it connects successfully.
So it is not a connection string issue.
By the look of the error signature, somehow DBNavigator is injecting properties in connection property that are not required by the connection.
I am not able to identify where is this getting added.
I tried digging thru the DBNavigator settings 1 by 1, could not find any thing.
Some configuration details:
DRIVER: io.prestosql:presto-jdbc:RELEASE
using presto-jdbc-348.jar as driver library
jdbc url: jdbc:presto://presto.x.x.run:80/hive
Database type : Generic
There is issue about this https://github.com/prestodb/presto/issues/9254
You can try to patch presto to ignore unknown JDBC properties:
https://github.com/vloup/presto/commit/3574e6944a5fc41f4adfe07168e990db94e531f4
I do not know, why this patch was not applied.

Response message: java.sql.SQLException: No pool found named: in jMeter

I am trying to do the Load testing on a new Database XpressMP. So I started using jMeter for that. I configured jMeter to make a Select call to our database. Below is configuration-
And below is the Snapshot for XMP Select DB
And if I start my test in the jMeter, I always get this exception-
Response message: java.sql.SQLException: No pool found named: 'ucirrus', ensure Variable Name matches Variable Name of JDBC Connection Configuration
What does this exception mean?
I am pretty much sure, this is the problem with my JDBC Request configuration in my previous image. As I am doing this for the first time.
Can anyone tell me how to fix this problem?
You problem is that you don't use the right variable name.
In JDBC Connection Configuration (within Variable Name bound to pool) set:
Variable Name : ucirrus

Weblogic set JDBC Shared

I'm using Weblogic and I set a JDBC driver to allow a service to get a connection to the db. This DB is also reachable by other clients for other purposes.What I want to do now, it's to make the JDBC connections "SHARED" with the other clients that connect to the database.
I read that the follow syntax let me achieve this:
jdbc:oracle:thin:<USER>/#(PROTOCOL = TCP)(HOST = <HOST>)(PORT = <PORT>)))(CONNECT_DATA = (SID = <SID>) (SERVER = SHARED)))
and would let me have the JDBC connections shared with the others regular connections.
Is it true ?
Where to set such parameters in weblogic ?
I'm currently using the JDBC driver ( SERVICES->JDBC->DATA SOURCES-> connection pool (tab) ) configured in the following manner:
URL:
jdbc:bea:oracle://[dbIP]:1521
Driver Class Name:
weblogic.jdbc.oracle.OracleDriver
Properties:
user=ETL
portNumber=1521
SID=LIVDEV1
serverName=[dbIP]
Thanks
The URL of Oracle should be jdbc:oracle:thin:#[host][:port]:SID.
No need to set these parameters in properties again, but you need to set the user
And for password, WebLogic already provides a standalone field for it. It will be encrypted by WebLogic.
You can reference http://download.oracle.com/docs/cd/E13222_01/wls/docs81/jdbc/programming.html#1053561

Connection Failed SQL Server

I have the following code snippet:
SqlConnection sr = new SqlConnection(this.strConnection);
sr.Open();
Where connection string is:
Data Source = localhost;Initial Catalog=UIB_IS;Persist Security info=True;User ID=USR;Password=PSW;
(I have removed the user name and password from above for purpose of this question - I have double checked the password has not expired and is still the same.)
Every time I try to open the connection I get a failed exception.
I have also tried using the Microsoft.SqlServer.Management.Smo.Server() object with a string connection as well as a ServerConnection object. With the server connection object using a string and SQLConnection object.
None seem to be working.
Within the connection string I have tried the syntax ServerName\SQLSERVERNAME, 127.0.0.1 as well as localhost as you can see above.
Previously this code has been working over the last 6 months using the 'ServerName\SQSERVERNAME' syntax in the connection string on a Microsoft.SqlServer.Management.Smo.Server() object.
This last week.....no longer works.
No System updates have been applied. The DB and SQL User exist with the appropriate permissions set as were before. SQL Server still has allow remote connections set to allow.
The server firewall is also off (Development machine)
I cannot understand why it would suddenly stop working?
Anyone have any ideas?
Thanks in advance.
Be sure that your Sql Server allow remote connections. You can check its status under Sql Server Surface Area Configuration --> Surface Area Configuration for Services and Connection.

Resources