You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Orange Trees <or...@outlook.com> on 2022/12/22 05:30:04 UTC

Re: [java] locale is changed for derby db in embedded mode

Hello,

Any suggestions please what and where should I check?

Regards,
Orange
________________________________
From: Orange Trees <or...@outlook.com>
Sent: 26 November 2022 10:23
To: users@netbeans.apache.org <us...@netbeans.apache.org>
Subject: [java] locale is changed for derby db in embedded mode

Hello,

There is a simple program which gives different results when I run it from the NetBeans IDE and outside IDE:

package derbytest4;

import java.sql.*;
import java.util.*;

public class DerbyTest4 {
    public static void main(String... args) throws Exception {
        println("Default locale = " + Locale.getDefault());
        Connection conn = DriverManager.getConnection("jdbc:derby:memory:db;create=true");
        conn.prepareStatement("CREATE TABLE t (a INT, b INT)").execute();

        try {
            DriverManager.getConnection("jdbc:derby:memory:db;shutdown=true");
        }
        catch (Exception ex) {
            println(ex.getMessage());
        }
    }
    private static void println(String text) { System.out.println(text); }
}

Note: Derby DB of the latest version jars should be included to the project.

The result from NetBeans IDE is:
Default locale = en_US
08006.D : [0] memory:db

The result from outside IDE is (which is expected):
Default locale = en_US
Database 'memory:db' shutdown.


As I was hinted in the Apache Derby mailing lists, this behaviour of Apache DB message not being printed correctly is related to locale settings, although in both cases locale seems ok.

For the older projects, which I have imported from the previous machine, everything works as expected, problem is with new projects.

I'm using NetBeans 14 and 13. I believe it is related to some settings, although I wasn't able to find something by myself.

My environment:
Virtualization: oracle
Operating System: Linux Mint 19.3
Kernel: Linux 5.0.0-32-generic
Architecture: x86-64

openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)

Regards,
Orange




Re: [java] locale is changed for derby db in embedded mode

Posted by Arnaud bourree <ar...@gmail.com>.
Hi,

It looks not local issue but classpath issue.
I think there are missing optional dependencies outside Netbeans.

Arnaud

Le jeu. 22 déc. 2022, 06:30, Orange Trees <or...@outlook.com> a
écrit :

> Hello,
>
> Any suggestions please what and where should I check?
>
> Regards,
> Orange
> ------------------------------
> *From:* Orange Trees <or...@outlook.com>
> *Sent:* 26 November 2022 10:23
> *To:* users@netbeans.apache.org <us...@netbeans.apache.org>
> *Subject:* [java] locale is changed for derby db in embedded mode
>
> Hello,
>
> There is a simple program which gives different results when I run it from
> the NetBeans IDE and outside IDE:
>
> package derbytest4;
>
> import java.sql.*;
> import java.util.*;
>
> public class DerbyTest4 {
>     public static void main(String... args) throws Exception {
>         println("Default locale = " + Locale.getDefault());
>         Connection conn =
> DriverManager.getConnection("jdbc:derby:memory:db;create=true");
>         conn.prepareStatement("CREATE TABLE t (a INT, b INT)").execute();
>
>         try {
>
> DriverManager.getConnection("jdbc:derby:memory:db;shutdown=true");
>         }
>         catch (Exception ex) {
>             println(ex.getMessage());
>         }
>     }
>     private static void println(String text) { System.out.println(text); }
> }
>
> Note: Derby DB of the latest version jars should be included to the
> project.
>
> The result from NetBeans IDE is:
> Default locale = en_US
> 08006.D : [0] memory:db
>
> The result from outside IDE is (which is expected):
> Default locale = en_US
> Database 'memory:db' shutdown.
>
>
> As I was hinted in the Apache Derby mailing lists, this behaviour of
> Apache DB message not being printed correctly is related to locale
> settings, although in both cases locale seems ok.
>
> For the older projects, which I have imported from the previous machine,
> everything works as expected, problem is with new projects.
>
> I'm using NetBeans 14 and 13. I believe it is related to some settings,
> although I wasn't able to find something by myself.
>
> My environment:
> Virtualization: oracle
> Operating System: Linux Mint 19.3
> Kernel: Linux 5.0.0-32-generic
> Architecture: x86-64
>
> openjdk version "17.0.5" 2022-10-18
> OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
> OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode,
> sharing)
>
> Regards,
> Orange
>
>
>
>