Posts

Showing posts with the label jdbc connection

Redis user permissions (ACL) and python connection

 Recently, I was working on setting up a redis cluster along with separate users for readwrite and readonly. I setup the readonly user using the below privileges (ACLs):   user redisreadonly on >mySuperSecretPassword ~* resetchannels -@all +@read +ping +asking   Once this is setup, I wrote a simple program in python to connect to the redis cluster using the readonly credentials and print the number of keys.   #!/usr/bin/env python3 """ pip3 install redis """ from redis.cluster import RedisCluster, ClusterNode # ─────── Cluster connection ─────── startup_nodes = [ ClusterNode("redis_host_1", 6379), ClusterNode("redis_host_2", 6379), ClusterNode("redis_host_3", 6379) ] rc = RedisCluster(startup_nodes=startup_nodes,decode_responses=True,username='redisreadonly',password='mySuperSecretPassw...

Check JDBC Connection String using java

Sometimes, I have faced a situation wherein the tnsping to the database is working but the JDBC connection fails. So, in order to check the JDBC connection string, one has to use a java program, which unfortunately isn't my forte. Thankfully, my friend, Padmaraj, who is a SME on java gave me a small piece of code which works wonderfully well. Note : Save the below java program as ReadCharacter.java, else the program won't work. // Program to check the JDBC Connection string. import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class ReadCharacter { public static void main(String[] args) { Connection dbConnection; Statement stmt; String sqlStmt; // For Oracle 9.2 String thin = "jdbc:oracle:thin:@[db_host]:[db_port]:[oracle_sid]"; String name = "[username]"; String pass = "[...

Popular posts from this blog

EXCEPTION_ACCESS_VIOLATION in Jinitiator and IE crashes

Version of mod_security with EBS 11.5.10.2

Read a file and extract specific lines using Native Ansible Modules