I'm working on a Java program that try to reset a user's password in oracle and sql-server. This password is a random generated password that will have some character that is not acceptable as a normal string. Eg. ',"",;
The command that I'm using to reset user's password is :
oracle: ALTER USER IDENTIFIED BY
sql-server: ALTER LOGIN WITH PASSWORD = ''
How can I do this reset so that it can accept all kind of special character?
I did google and found out about quoting method:. Also I did found out about using single code and double code. But what if the password generated have a " or same quote delimiter inside that password? Then it will be a problem.
Eg. IDENTIFIED BY 'jks'k"fjh''d'
Eg. password = q[#kkksdj#jsksls#]
Eg. password = "nm.js""kh:kjhs"
Is there any way for me to do this inside the oracle and sql-server? Or do I need to escape each character one by one from java before sending to oracle/sql-server? My reset program for oracle and sql-server are different. So the method can be different.