Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Keith Medcalf

That would be my estimation.

Of course, you could also try setting the busy timeout using the pragma:

https://www.sqlite.org/pragma.html#pragma_busy_timeout

as soon as you open the connection.

On Friday, 9 December, 2016 15:17 Jay Weinstein <jpwe...@gmail.com> said:

> Hi Keith,
> 
> Made sure the timeouts are set to 1000 ms for both C and java
> implementations.  Same error.   So, you are suggesting this is an issue
> with the guys who wrote the driver for sqlite?   Not sure who these guys
> are.
> 
> On Fri, Dec 9, 2016 at 11:22 AM, Keith Medcalf <kmedc...@dessus.com>
> wrote:
> 
> >
> > Sounds like a java problem with the java interface, not an SQLite
> > problem.  Two observations however:
> >
> > 1)  With the C API you set the busy timeout to 1000 ms but with the java
> > api you set it to 100 ms
> > 2)  With the C API you set the busy timeout to the integer 1000 yet in
> the
> > java api you set it to the string "100"
> >
> > In any case, the problem is in the Java API.  You have demonstrated that
> > the problem is not caused by SQLite itself ...
> >
> > Perhaps a chat with the Java wrapper developers is in order.
> >
> >
> > > -Original Message-
> > > From: sqlite-users [mailto:sqlite-users-
> boun...@mailinglists.sqlite.org]
> > > On Behalf Of Jay Weinstein
> > > Sent: Friday, 9 December, 2016 11:50
> > > To: SQLite mailing list
> > > Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> > > database file is locked (database is locked)
> > >
> > > When I run the two C programs using
> > >
> > >   rc = sqlite3_busy_timeout(db, 1000);
> > >   if ( rc != SQLITE_OK ) {
> > > fprintf(stderr, "SQL error: sqlite3_busy_timeout
> > > failed.\n");
> > > exit(0);
> > >   }
> > >
> > > everything works perfectly.  No sqlite busy erros or table locked.
> > >
> > > But, when I to do this using a java app using the following the code
> > > doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> > > working as I anticipated --  see below.   Can you advise?
> > >
> > > Thanks, Jay
> > >
> > > Class.forName("org.sqlite.JDBC");
> > > String s = "jdbc:sqlite:"+db;
> > >
> > > config = new SQLiteConfig();
> > > config.setBusyTimeout("100");
> > > conn = DriverManager.getConnection(s, config.toProperties());
> > > conn.setAutoCommit(false);
> > > stmt = conn.createStatement();
> > >
> > > On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin <slav...@bigfraud.org>
> > wrote:
> > >
> > > >
> > > > On 7 Dec 2016, at 11:28pm, Jay Weinstein <jpwe...@gmail.com> wrote:
> > > >
> > > > > Is it correct to say busy timeout will work for two separate
> > processes
> > > > and
> > > > > I don't have use fork in C/C++ or ProcessBuilder in java to
> execute
> > > one
> > > > as
> > > > > a child and a parent?
> > > >
> > > > The timeout setting is attached to the database connection.  If you
> > > > execute _open() twice you need to set it once for each connection.
> > > >
> > > > Simon.
> > > > ___
> > > > sqlite-users mailing list
> > > > sqlite-users@mailinglists.sqlite.org
> > > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > > >
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Jay Weinstein
Hi Keith,

Made sure the timeouts are set to 1000 ms for both C and java
implementations.  Same error.   So, you are suggesting this is an issue
with the guys who wrote the driver for sqlite?   Not sure who these guys
are.

On Fri, Dec 9, 2016 at 11:22 AM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> Sounds like a java problem with the java interface, not an SQLite
> problem.  Two observations however:
>
> 1)  With the C API you set the busy timeout to 1000 ms but with the java
> api you set it to 100 ms
> 2)  With the C API you set the busy timeout to the integer 1000 yet in the
> java api you set it to the string "100"
>
> In any case, the problem is in the Java API.  You have demonstrated that
> the problem is not caused by SQLite itself ...
>
> Perhaps a chat with the Java wrapper developers is in order.
>
>
> > -Original Message-
> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> > On Behalf Of Jay Weinstein
> > Sent: Friday, 9 December, 2016 11:50
> > To: SQLite mailing list
> > Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> > database file is locked (database is locked)
> >
> > When I run the two C programs using
> >
> >   rc = sqlite3_busy_timeout(db, 1000);
> >   if ( rc != SQLITE_OK ) {
> > fprintf(stderr, "SQL error: sqlite3_busy_timeout
> > failed.\n");
> > exit(0);
> >   }
> >
> > everything works perfectly.  No sqlite busy erros or table locked.
> >
> > But, when I to do this using a java app using the following the code
> > doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> > working as I anticipated --  see below.   Can you advise?
> >
> > Thanks, Jay
> >
> > Class.forName("org.sqlite.JDBC");
> > String s = "jdbc:sqlite:"+db;
> >
> > config = new SQLiteConfig();
> > config.setBusyTimeout("100");
> > conn = DriverManager.getConnection(s, config.toProperties());
> > conn.setAutoCommit(false);
> > stmt = conn.createStatement();
> >
> > On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin <slav...@bigfraud.org>
> wrote:
> >
> > >
> > > On 7 Dec 2016, at 11:28pm, Jay Weinstein <jpwe...@gmail.com> wrote:
> > >
> > > > Is it correct to say busy timeout will work for two separate
> processes
> > > and
> > > > I don't have use fork in C/C++ or ProcessBuilder in java to execute
> > one
> > > as
> > > > a child and a parent?
> > >
> > > The timeout setting is attached to the database connection.  If you
> > > execute _open() twice you need to set it once for each connection.
> > >
> > > Simon.
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Keith Medcalf

Sounds like a java problem with the java interface, not an SQLite problem.  Two 
observations however:

1)  With the C API you set the busy timeout to 1000 ms but with the java api 
you set it to 100 ms
2)  With the C API you set the busy timeout to the integer 1000 yet in the java 
api you set it to the string "100"

In any case, the problem is in the Java API.  You have demonstrated that the 
problem is not caused by SQLite itself ...

Perhaps a chat with the Java wrapper developers is in order.


> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Jay Weinstein
> Sent: Friday, 9 December, 2016 11:50
> To: SQLite mailing list
> Subject: Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The
> database file is locked (database is locked)
> 
> When I run the two C programs using
> 
>   rc = sqlite3_busy_timeout(db, 1000);
>   if ( rc != SQLITE_OK ) {
> fprintf(stderr, "SQL error: sqlite3_busy_timeout
> failed.\n");
> exit(0);
>   }
> 
> everything works perfectly.  No sqlite busy erros or table locked.
> 
> But, when I to do this using a java app using the following the code
> doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
> working as I anticipated --  see below.   Can you advise?
> 
> Thanks, Jay
> 
> Class.forName("org.sqlite.JDBC");
> String s = "jdbc:sqlite:"+db;
> 
> config = new SQLiteConfig();
> config.setBusyTimeout("100");
> conn = DriverManager.getConnection(s, config.toProperties());
> conn.setAutoCommit(false);
> stmt = conn.createStatement();
> 
> On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin <slav...@bigfraud.org> wrote:
> 
> >
> > On 7 Dec 2016, at 11:28pm, Jay Weinstein <jpwe...@gmail.com> wrote:
> >
> > > Is it correct to say busy timeout will work for two separate processes
> > and
> > > I don't have use fork in C/C++ or ProcessBuilder in java to execute
> one
> > as
> > > a child and a parent?
> >
> > The timeout setting is attached to the database connection.  If you
> > execute _open() twice you need to set it once for each connection.
> >
> > Simon.
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-09 Thread Jay Weinstein
When I run the two C programs using

  rc = sqlite3_busy_timeout(db, 1000);
  if ( rc != SQLITE_OK ) {
fprintf(stderr, "SQL error: sqlite3_busy_timeout
failed.\n");
exit(0);
  }

everything works perfectly.  No sqlite busy erros or table locked.

But, when I to do this using a java app using the following the code
doesn't work.  Basically, config.setBusyTimeout() doesn't seem to be
working as I anticipated --  see below.   Can you advise?

Thanks, Jay

Class.forName("org.sqlite.JDBC");
String s = "jdbc:sqlite:"+db;

config = new SQLiteConfig();
config.setBusyTimeout("100");
conn = DriverManager.getConnection(s, config.toProperties());
conn.setAutoCommit(false);
stmt = conn.createStatement();

On Wed, Dec 7, 2016 at 4:17 PM, Simon Slavin  wrote:

>
> On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:
>
> > Is it correct to say busy timeout will work for two separate processes
> and
> > I don't have use fork in C/C++ or ProcessBuilder in java to execute one
> as
> > a child and a parent?
>
> The timeout setting is attached to the database connection.  If you
> execute _open() twice you need to set it once for each connection.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread Simon Slavin

On 7 Dec 2016, at 11:28pm, Jay Weinstein  wrote:

> Is it correct to say busy timeout will work for two separate processes and
> I don't have use fork in C/C++ or ProcessBuilder in java to execute one as
> a child and a parent?

The timeout setting is attached to the database connection.  If you execute 
_open() twice you need to set it once for each connection.

Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread Jay Weinstein
Hi,

Is it correct to say busy timeout will work for two separate processes and
I don't have use fork in C/C++ or ProcessBuilder in java to execute one as
a child and a parent?

Thanks,
Jay

On Wed, Dec 7, 2016 at 11:02 AM, R Smith  wrote:

> Yes, multiple access is a feature, a basic necessity even.
>
> The answer is here:
> http://www.sqlite.org/pragma.html#pragma_busy_timeout
>
> Explanation:
> https://www.sqlite.org/c3ref/busy_timeout.html
>
> and
> http://www.sqlite.org/tclsqlite.html
> see the section: The "timeout" method
>
>
>
> On 2016/12/07 8:54 PM, Jay Weinstein wrote:
>
>> Hi,
>>
>> I’m running two programs, one written in java and one written in C, which
>> are both trying to access a sqlite database.  I'm getting the error
>> org.sqlite.SQLiteException: [SQLITE_BUSY]  The database file is locked
>> (database is locked) when I run both as separate processes and when the
>> java app launches the c program with ProcessBuilder.   Is there away for
>> two process to read and write a sqlite database?
>>
>> Thanks,
>> Jay
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread Jay Weinstein
Thanks for  the info!

On Wed, Dec 7, 2016 at 11:02 AM, R Smith  wrote:

> Yes, multiple access is a feature, a basic necessity even.
>
> The answer is here:
> http://www.sqlite.org/pragma.html#pragma_busy_timeout
>
> Explanation:
> https://www.sqlite.org/c3ref/busy_timeout.html
>
> and
> http://www.sqlite.org/tclsqlite.html
> see the section: The "timeout" method
>
>
>
> On 2016/12/07 8:54 PM, Jay Weinstein wrote:
>
>> Hi,
>>
>> I’m running two programs, one written in java and one written in C, which
>> are both trying to access a sqlite database.  I'm getting the error
>> org.sqlite.SQLiteException: [SQLITE_BUSY]  The database file is locked
>> (database is locked) when I run both as separate processes and when the
>> java app launches the c program with ProcessBuilder.   Is there away for
>> two process to read and write a sqlite database?
>>
>> Thanks,
>> Jay
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread R Smith

Yes, multiple access is a feature, a basic necessity even.

The answer is here:
http://www.sqlite.org/pragma.html#pragma_busy_timeout

Explanation:
https://www.sqlite.org/c3ref/busy_timeout.html

and
http://www.sqlite.org/tclsqlite.html
see the section: The "timeout" method


On 2016/12/07 8:54 PM, Jay Weinstein wrote:

Hi,

I’m running two programs, one written in java and one written in C, which are 
both trying to access a sqlite database.  I'm getting the error 
org.sqlite.SQLiteException: [SQLITE_BUSY]  The database file is locked 
(database is locked) when I run both as separate processes and when the java 
app launches the c program with ProcessBuilder.   Is there away for two process 
to read and write a sqlite database?

Thanks,
Jay


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread Simon Slavin

On 7 Dec 2016, at 6:54pm, Jay Weinstein  wrote:

> I’m running two programs, one written in java and one written in C, which are 
> both trying to access a sqlite database.  I'm getting the error 
> org.sqlite.SQLiteException: [SQLITE_BUSY]  The database file is locked 
> (database is locked) when I run both as separate processes and when the java 
> app launches the c program with ProcessBuilder.

Are you getting this every single time for every single access ?  Or do you 
mean you get that result occasionally ?

If the latter then you should be able to solve it by setting a timeout value:



Simon.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

2016-12-07 Thread Jay Weinstein
Hi,

I’m running two programs, one written in java and one written in C, which are 
both trying to access a sqlite database.  I'm getting the error 
org.sqlite.SQLiteException: [SQLITE_BUSY]  The database file is locked 
(database is locked) when I run both as separate processes and when the java 
app launches the c program with ProcessBuilder.   Is there away for two process 
to read and write a sqlite database?

Thanks,
Jay


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users