JDBC connection string for clustered environment - tomcat7

I have 2 nodes sql server 2012 installed and clustered and configured Always On feature with Synchronized option.
Clustername: Cluster1
node 1 name: db1
node 2 name: db2
SQL Availability group name: AVG1 has 2 IP address( 10.X.30.7 and 10.X.31.7)
N0w i need to connect to the database from the application( using tomcat 7). Could you please let me know the jdbc syntax how to connect to the database ?
What would be the SQL server name i have to mention in my application?
And Could you please share JDBC connection example string with the above data?
Let me know for more details

So, if you have created an availability group listener, then that is the server name that you have to reference as this is the name that the windows cluster keeps online as a resource so that the servername never changes no matter what replica the availability group is running on.
The connection string also depends on what port you set the listener up on too, but I'm going to assume that you are using a default instance, your listener is called AG-Listener and it is running on port 1433:
jdbc:sqlserver://AG-Listener:1433;databaseName=YourDB;user=MyUserName;password=*****;
You can find many more examples of JDBC connection strings here:
Building the Connection URL

Related

JMeter-JDBC Connection error

While running an SQl query in JMeter using JDBC request, I'm getting:
SQL ConnectionException:Cannot create Poolable Connectionfactory
(IO error:Network Adapter could not establish the connection).
Installed Oracle11g in virtual machine.
Please give me solution.
Thanks in Advance.
Make sure you have Oracle JDBC driver somewhere in JMeter Classpath
Make sure you have configured network adapter in the virtual machine in Bridge mode (not "host-only", not "NAT") so the virtual machine would have its own IP address.
Make sure port 1521 (or whatever is used by Oracle) is not blocked by OS firewall. Check if you are able to connect to the port using i.e. telnet client
Add JDBC Connection Configuration test element and provide JDBC url of your Oracle instance along with credentials there.
See The Real Secret to Building a Database Test Plan With JMeter guide to learn more about setting up JMeter for databases load testing

What is the right MariaDB Galera jdbc URL properties for loadbalance

I have setup have 2 nodes of MariaDB 10.0 Galera cluster running on both private IPs of 192.168.2.51 and 192.168.2.52. I'm about to try connecting to the cluster using MariaDB's JDBC Client (org.mariadb.jdbc.Driver) provided by MariaDB's website.
It worked with the regular url like: "jdbc:mariadb://192.168.2.51:3306,192.168.2.52:3306/dbname".
But what I am trying to achieve is the possibility with the MySQL JDBC Driver, with url like: "jdbc:mysql://192.168.2.51,192.168.2.52/dbname?autoReconnect=true&autoReconnectForPools=true&failoverReadonly=false&roundRobinLoadBalance=true"
I have compared the properties stated in MariaDB (https://mariadb.com/kb/en/about-the-mariadb-java-client/) and MySQL (http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html). For the MariaDB JDBC Client, it doesn't seem to have properties that deal with loadbalance or autoReconnect.
So my question is:
Is there a right recommended way to connect (with loadbalance and failover capability) to MariaDB Galera through the MariaDB JDBC Driver or should I fall back to MySQL's ConnectorJ and how compatible is ConnectorJ with regards to MariaDB Galera cluster?
Thank you.
There is no loadbalance or failover capability in MariaDB JDBC . Even the multiple endpoint feature you used is not documented and is experimental. ConnectorJ loadbalancing should work fine, because to it, MariaDB Galera is just instances of regular MySQL.
You just use failover.
From what I observe, jdbc:mariadb:failover in mariadb connector equals jdbc:mysql:loadbalance in mysql connector;
and jdbc:mariadb:sequential in mariadb equals jdbc:mysql:failover in mysql.
This is a bit confusing.
In Mariadb, even the word is failover, the read/write load is actually spread across all nodes. I prefer to use sequential so that the connections are always to one node, which is more reliable in some cases, such as with galera multi-master cluster.
https://mariadb.com/kb/en/library/about-mariadb-connector-j/

Oracle Connection String for RAC Environment?

I have got an ORACLE RAC Environment access .The details are
Database Name: orcl
Service Name: orcl
IP Address: 192.168.1.1 and 192.168.1.2
SQL> host srvctl status database -d orcl
Instance orcl1 is running on node orclnode1
Instance orcl2 is running on node orclnode2
My concern is my connection, which is being established using
(DESCRIPTION=(ADDRESS=
(PROTOCOL=TCP)(HOST=192.168.1.1) (PORT=1521)
)(CONNECT_DATA=(SID=orcl1)))
But the provider wants it to be connected via the orcl service name .
I don`t have any other info related to this. Am I connecting correctly or I need hostname or IP address for orcl service name.
Your connection string is referencing one instance on one server/node. You should be using the common service name instead, and identifying all the servers it is available on.
The equivalent for you would be something like this (line breaks just for clarity here):
(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521))
)(CONNECT_DATA=(SERVICE_NAME=orcl)))
As long as it is resolvable, it shouldn't matter whether you use the DNS names or the IP addresses for the HOST parameters.
You may also need the LOAD_BALANCE or FAILOVER parameters; see the docs.

how to connect to oracle rac in asp.net

We just set up the Oracle RAC environment today and we use the single oracle database instance before.
Now we have four nodes in the RAC whose physical IPs are :
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
Also the there are four virtual IPs:
192.168.1.11
192.168.1.22
192.168.1.33
192.168.1.44
And we can connect 192.168.1.1 to use the oracle EM Database Console.
Now I do not know how to set the connection string in my web.config of the asp.net application.
Since when we use the single instance we just set the string like this:
provider=MSDAORA;data source=ORCL;user id=xx;password=xx
The "ORCL" here is the local net service name which can be found in the tnsnames.ora(the machine on which the IIS work).
Any idea?
UPDATE:
I use the oledb api.
You didn't make mention of SCAN address, so, I assume you're not on 11gR2.
Since your OLE data source makes reference to the ORCL connection identifier, that's where you'll want to configure your RAC load balancing and failover, in the tnsnames.ora definition of 'ORCL'.
Something like this ought to do it:
ORCL=
(DESCRIPTION=
(LOAD_BALANCE=ON)
(FAILOVER=ON)
(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.11)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.22)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.33)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.44)(PORT=1521))
)
(CONNECT_DATA=(FAILOVER_MODE=(TYPE=SELECT)
(METHOD=BASIC)
)
(SERVICE_NAME=ORCL)
)
)
Hope that helps.

How to have a single IP for Rapid Application Cluster (RAC) oracle cluster and WIndows Server 2008?

I have a multi tier application that want to use a RAC to improve the availability of the server.
What we have now is, the client side sending a transaction data to the server side through a webservice. At client level, we need to specify the url address (IP address) as a path to send a data.
As for now, there are 2 oracle instance installed as a RAC at a server.
1. 133.38.52.101
2. 133.38.52.102
Both of the server are connect to same Oracle Database (SAN storage).
Let say, the client side is pointing to .101. Suddenly the .101 machine is down, how can I possible to use the .102 without changing the point URL at the client side. Is there any configuration can be done at RAC or Windows Server 2008 for this type of problem?
Use a load balancer between client machine and application server machines.
Use Oracle's transparent application failover functionality in OCI to achieve redundancy and load balancing between application server machines and RAC instances. DML transactions will be rolled back but selects will be transparently failed over.

Resources