0

Interesting Oracle Authentication Behavior

Oracle

Oracle doesn't allow (by default) usernames that begin with a number, as well as certain special characters in usernames and passwords.  After doing some research, I learn that Oracle will allow almost ANY username and password, as long as they are provided in quotes:

So, (in Java) this:
stmt.executeUpdate("alter user " + loginName + " identified by " + password);

Becomes this:
stmt.executeUpdate("alter user \"" + loginName + "\" identified by \"" + password + "\"");

No problemo.  But there is a "gotcha"!  When you add the quotes, usernames become CASE SENSITIVE!

Luckily for us, all of the usernames in this system are uppercase.  so a quick addition, and you're good to go:
stmt.executeUpdate("alter user \"" + loginName.toUpperCase() + "\" identified by \"" + password + "\"");

I don't usually post Oracle stuff, but since there was so little information on this behavior, I thought I would share. Maybe it will help someone else out. :)

tags:
oracle

Search