Search code examples
javaoracle-databaseintellij-ideaoracle11gplsqldeveloper

Can't connect to oracle database with IntelliJ, Locale not recognized


I have Oracle Database 11g Express Edition installed, and can normally connect to my local database with PLSQL Developer, but I can't connect with IntelliJ. It says Locale not recognized.

enter image description here

After searching for some similar questions here, solution was kinda to change the machine locale manually, I did that and rebooted, but it still does not work. And I'm sure it really changed, because now, this line of java code: System.out.println(Locale.getDefault()) printed en_US.

Now i really don't know what is the problem, why does PLSQL work and IntelliJ does not.

I am using ojdbc6.jar for connection.

When I tried to connect with the java code below the same kind of exception was thrown.

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "SYSTEM", "password");

exception:

Exception in thread "main" java.sql.SQLException: Locale not recognized
    at oracle.jdbc.driver.T4CTTIoauthenticate.setSessionFields(T4CTTIoauthenticate.java:1006)
    at oracle.jdbc.driver.T4CTTIoauthenticate.<init>(T4CTTIoauthenticate.java:238)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at data_coonnections.DataConnector.main(DataConnector.java:15)

Solution

  • Additionally changing Format(in Control Panel -> Clock and Region -> Region -> Format) to English (United States) did help.