Re: Is create=true thread-safe?

2020-03-20 Thread Rick Hillegas
The first thread which gets through will create the database and the 
others will block until the first thread finishes. I am not aware of any 
thead safety issues here. Do you have a test case which suggests otherwise?


Thanks,
-Rick

On 3/19/20 10:24 PM, Behrang Saeedzadeh wrote:

Hi,

Is the create=true attribute

thread-safe?

In particular, what would happen if 10 threads at the same time try to
obtain this connection:

 DriverManager.getConnection("jdbc:derby:mydb;create=true);

(when Derby is used as an embedded database)? Is this safe?

The docs say:


If the database already exists, the attribute creates a connection to the

existing database, and an *SQLWarning* is issued.

But it is not clear if that implies `create=true` is thread safe.





Is create=true thread-safe?

2020-03-19 Thread Behrang Saeedzadeh
Hi,

Is the create=true attribute

thread-safe?

In particular, what would happen if 10 threads at the same time try to
obtain this connection:

DriverManager.getConnection("jdbc:derby:mydb;create=true);

(when Derby is used as an embedded database)? Is this safe?

The docs say:

> If the database already exists, the attribute creates a connection to the
existing database, and an *SQLWarning* is issued.

But it is not clear if that implies `create=true` is thread safe.

-- 
Best regards,
Behrang Saeedzadeh