I try to change an expired password from Java. That's not possible with thin client, but should work with "thick", i.e. OCI. So far, I have this:
1. Properties props = new Properties();
2. props.put("user", "my username");
3. props.put("password", "my old password");
4. props.put("OCINewPassword", "my new password");
5. String ociUrl = "jdbc:oracle:oci:@...";
6. Connection connection = DriverManager.getConnection(ociUrl, props);
But I'm getting a "java.sql.SQLException: ORA-01017: invalid username/password; logon denied".
The client's OS is Windows 7. Oracle instant client (11.2) is installed and on the Path. The database is Oracle 11.2.
And "my old password" is correct. If I comment out line 4, connecting works. If I use :thin: driver, connecting works also, but the property "OCINewPassword" is then being ignored.
You don't say which OJDBC jar file (name and version) you are using and that is critical for OCI.
More importantly see Joe Weinstein's reply right below mine:
However, in the OCI mode there is a rigid
one-to-one relationship between a single given driver jar version and a single
version of the OCI client libraries. If you update one without the other, you
will get inscrutable failures.
And there is more information and examples in the JDBC Dev Guide
It's ojdbc6.jar, Implementation-Version: 184.108.40.206.0. I took it from the download of instant client, so the version of jar an dlls should match. I read the thread you mentioned (that's where my code is from ;-)).
I'm aware that for "normal use" thin client is the way to go and I need th OCI client only for the specific purpose "password change".
It's good to hear, that in your case it works. So I see a chance bringig it up and running. Still, my problem remains ;-).
I'll consume http://docs.oracle.com/cd/E11882_01/java.112/e16548/instclnt.htm#CHDCJEDD again, see if I find something.
I tried also OracleOCIConnectionPool, passing the new password using as a property:
Properties props = new Properties();
props.put("OCINewPassword", "my new password");
OracleOCIConnectionPool pool = new OracleOCIConnectionPool("my user", "my password", "the url", props);
But away from the fact that it's useless to use a pool in this case, I got here another exception: java.sql.SQLException: Ungültige Connection Pool-Konfiguratin des JDBC-OCI-Treibers angegeben (which means "invalid connection pool configuration of jdbc-oci-driver").
There is not only a rigid one-to-one relationship between a single given driver jar version and a single version of the OCI client libraries (Joe Weinstein) but apparently also between the thin client's and the database's version. Our database is 220.127.116.11 and I was using instant client 18.104.22.168. Switched to instant client 22.214.171.124 and - guess what? It works.