Reputation: 94
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.
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)
Upvotes: 2
Views: 5577
Reputation: 81
Instead of changing the regional settings of the OS you can go to the "Advanced" tab (see the picture that you posted) and down to the "VM options:" field.
Enter -Duser.language=en -Duser.region=US
.
You can also set -Duser.region=UK
or what ever region is recognized.
Upvotes: 2
Reputation: 3763
The JDBC thin driver uses the Java's Locale to change your Database session language. For example I'm French, I live in France, when I connect to a Database in the US from my local system my Database session is in French. Why? That's because my Locale is configured this way. You can always override the default Locale to something else if your Locale isn't recognized by Oracle.
Upvotes: 0
Reputation: 94
Additionally changing Format(in Control Panel -> Clock and Region -> Region -> Format) to English (United States) did help.
Upvotes: 2