You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Daniel John Debrunner <dj...@apache.org> on 2006/04/06 04:25:23 UTC

Re: derby and torque transaction handling

Glenn Marintes wrote:

> Hi All,
> 
> How do we use transactions in Derby using Torque?
> 
> |static java.sql.Connection| |*begin
> <ci...@janet.co.jp>*(java.lang.String dbName)|
> 
> method of Transaction class returns a Connection. And to do that, I believe
> that it will try to make a connection to the database. Since Derby
> supports only
> 1 connection, it wont work?

Derby supports multiple connections. Other than that I'm not sure I can
help. Does this tutorial help?

http://db.apache.org/derby/integrate/db_torque.html

Dan.


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
Andreas Korneliussen wrote:
> Glenn Marintes wrote:
>> Hi Dan!
>> Thanks for your quick reply.
>>> Derby supports multiple connections. Other than that I'm not sure I can
>>> help. Does this tutorial help?
>>>   
>> I will verify Derby's multiple concurrent connections support then. I 
>> had got some info from one
>> of my superiors telling me that Derby does not support multiple 
>> concurrent Connections :(
>> Its best to try it out I think.
>>
>>> http://db.apache.org/derby/integrate/db_torque.html
>>>   
>> Yes. I had read this tutorial.
>>
>> Regarding Derby, I'm having some trouble with it.
>> I get an SQLException with "XSDF1" sql state when I try to 
>> executeQuery("CREATE TABLE <more ...>");
>>
>> Its kinda weird because the same executeQuery call works on another 
>> test class. But when I run
>> the real app, I always get the XSDF1 exception. Please note that I 
>> have tried the execute() and executeUpdate()
>> too.
>
> You should use execute() or executeUpdate(..) when executing "CREATE 
> TABLE.."
>
>>
>> I have 1GB+ free space on the drive where Derby db is being created :(
>> What are the other reasons for the XSDF1 sql state?
>>
>
> Other reasons may be that the file exists already. If you have the 
> stack trace for the exception, we could check the source to see where 
> it was thrown from.
>
> Andreas
>
>> Thanks and more power!
>>
>
>
Also, please note that I have verified the file  
E:\docs\old\workspace\workspace_jb\JavaBackupCl\work_dir1\db\seg0\c450.dat
does not exist before and after the XSDF1 exception

-- 
*******************************************
*
* Glenn M. Marintes
* Software Development Section
* JANET
* 


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
>
> Ok. I looked at the source. It seems you can also get this exception 
> if there is some SecurityException. Do you run with security manager ? 
> If so, maybe you need to update the policy file.
>
> Andreas
>
>
Thanks for all the help up to now.
I just got an idea as to where the exception occurs though :(
Its not with security, disk space or already existing file.
I think its because some other thread is interrupting the current thread 
(the one that calls the query)
and hence, the file channel is closed (if its in a write() call or other 
IO).

Anyway, I'll just try something. Will mail again in 10 mins.
Thanks.


-- 
*******************************************
*
* Glenn M. Marintes
* Software Development Section
* JANET
* 


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
Andreas Korneliussen wrote:
> Glenn Marintes wrote:
>>
>>>
>>> You should use execute() or executeUpdate(..) when executing "CREATE 
>>> TABLE.."
>>>
>> Yes.. I tried using execute() and executeUpdate(..) but I still have 
>> the exception :(
>>>>
>>>> I have 1GB+ free space on the drive where Derby db is being created :(
>>>> What are the other reasons for the XSDF1 sql state?
>>>>
>>>
>>> Other reasons may be that the file exists already. If you have the 
>>> stack trace for the exception, we could check the source to see 
>>> where it was thrown from.
>>>
>> I have checked it. The .dat file that the exception is printing is 
>> not existing in the directory.
>>
>
> Ok. I looked at the source. It seems you can also get this exception 
> if there is some SecurityException. Do you run with security manager ? 
> If so, maybe you need to update the policy file.
>
> Andreas
>
>

I got it working!!!
It was not working because some other thread interrupted the thread that 
called the executeUpdate().
Actually the interrupt occurred even before the executeUpdate() was 
called and hence, was very hard
to track.

Anyway, thanks for all the help.



-- 
*******************************************
*
* Glenn M. Marintes
* Software Development Section
* JANET
* 


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
>
> Ok. I looked at the source. It seems you can also get this exception 
> if there is some SecurityException. Do you run with security manager ? 
> If so, maybe you need to update the policy file.
>
> Andreas
>
>
Thanks for all the help up to now.
I just got an idea as to where the exception occurs though :(
Its not with security, disk space or already existing file.
I think its because some other thread is interrupting the current thread 
(the one that calls the query)
and hence, the file channel is closed (if its in a write() call or other 
IO).

Anyway, I'll just try something. Will mail again in 10 mins.
Thanks.


-- 
*******************************************
*
* Glenn M. Marintes
* Software Development Section
* JANET
* 


Re: derby and torque transaction handling

Posted by Andreas Korneliussen <An...@Sun.COM>.
Glenn Marintes wrote:
> 
>>
>> You should use execute() or executeUpdate(..) when executing "CREATE 
>> TABLE.."
>>
> Yes.. I tried using execute() and executeUpdate(..) but I still have the 
> exception :(
>>>
>>> I have 1GB+ free space on the drive where Derby db is being created :(
>>> What are the other reasons for the XSDF1 sql state?
>>>
>>
>> Other reasons may be that the file exists already. If you have the 
>> stack trace for the exception, we could check the source to see where 
>> it was thrown from.
>>
> I have checked it. The .dat file that the exception is printing is not 
> existing in the directory.
> 

Ok. I looked at the source. It seems you can also get this exception if 
there is some SecurityException. Do you run with security manager ? If 
so, maybe you need to update the policy file.

Andreas


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
>
> You should use execute() or executeUpdate(..) when executing "CREATE 
> TABLE.."
>
Yes.. I tried using execute() and executeUpdate(..) but I still have the 
exception :(
>>
>> I have 1GB+ free space on the drive where Derby db is being created :(
>> What are the other reasons for the XSDF1 sql state?
>>
>
> Other reasons may be that the file exists already. If you have the 
> stack trace for the exception, we could check the source to see where 
> it was thrown from.
>
I have checked it. The .dat file that the exception is printing is not 
existing in the directory.

Here's the stacktrace (I hope this will help):
ERROR XSDF1: Exception during creation of file 
E:\docs\old\workspace\workspace_jb\JavaBackupCl\work_dir1\db\seg0\c430.dat 
for container
    at 
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.store.raw.data.RAFContainer.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at 
org.apache.derby.impl.store.raw.data.RAFContainer.createContainer(Unknown 
Source)
    at 
org.apache.derby.impl.store.raw.data.FileContainer.createIdent(Unknown 
Source)
    at 
org.apache.derby.impl.store.raw.data.RAFContainer.createIdentity(Unknown 
Source)
    at 
org.apache.derby.impl.services.cache.CachedItem.takeOnIdentity(Unknown 
Source)
    at org.apache.derby.impl.services.cache.Clock.addEntry(Unknown Source)
    at org.apache.derby.impl.services.cache.Clock.create(Unknown Source)
    at 
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.addContainer(Unknown 
Source)
    at org.apache.derby.impl.store.raw.xact.Xact.addContainer(Unknown 
Source)
    at org.apache.derby.impl.store.access.heap.Heap.create(Unknown Source)
    at 
org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.createConglomerate(Unknown 
Source)
    at 
org.apache.derby.impl.store.access.RAMTransaction.createConglomerate(Unknown 
Source)
    at 
org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown 
Source)
    at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source)
    at 
org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
    at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
Source)
    at 
com.las.platf.cm.db.hsql.AbstractDBManager.doExecuteUpdate(AbstractDBManager.java:208)
    at 
com.las.jbckup.cm.data.db.DBManager.doExecuteUpdate(DBManager.java:402)
    at 
com.las.jbckup.cm.data.db.DBManager.createVerFilesNTable(DBManager.java:1541)
    at 
com.las.jbckup.cl.data.DBManager.createVerFilesNTable(DBManager.java:90)
    at com.las.jbckup.cm.data.db.DBManager.addVersion(DBManager.java:2310)
    at 
com.las.jbckup.cl.phases.BackupController$ControllerEventListener.onBackupBeginProceed(BackupController.java:634)
    at 
com.las.jbckup.cl.event.BackupProceedEvent.fireEvent(BackupProceedEvent.java:17)
    at 
com.las.jbckup.cl.event.AbstractGlobalEvent.invoke(AbstractGlobalEvent.java:34)
    at 
com.las.jbckup.cl.phases.handlers.FrameBackupBeginProceedHandler.handle(FrameBackupBeginProceedHandler.java:33)
    at 
com.las.jbckup.cl.phases.Communicator$CommunicatorDataArrivalListener.dataArrived(Communicator.java:247)
    at 
com.las.jbckup.cl.event.DataArrivedEvent.fireEvent(DataArrivedEvent.java:29)
    at 
com.las.jbckup.cl.event.AbstractGlobalEvent.invoke(AbstractGlobalEvent.java:34)
    at 
com.las.jbckup.cl.phases.QOSLimiter$DataReader.run(QOSLimiter.java:502)


Re: derby and torque transaction handling

Posted by Andreas Korneliussen <An...@Sun.COM>.
Glenn Marintes wrote:
> Hi Dan!
> Thanks for your quick reply.
>> Derby supports multiple connections. Other than that I'm not sure I can
>> help. Does this tutorial help?
>>   
> I will verify Derby's multiple concurrent connections support then. I 
> had got some info from one
> of my superiors telling me that Derby does not support multiple 
> concurrent Connections :(
> Its best to try it out I think.
> 
>> http://db.apache.org/derby/integrate/db_torque.html
>>   
> Yes. I had read this tutorial.
> 
> Regarding Derby, I'm having some trouble with it.
> I get an SQLException with "XSDF1" sql state when I try to 
> executeQuery("CREATE TABLE <more ...>");
> 
> Its kinda weird because the same executeQuery call works on another test 
> class. But when I run
> the real app, I always get the XSDF1 exception. Please note that I have 
> tried the execute() and executeUpdate()
> too.

You should use execute() or executeUpdate(..) when executing "CREATE 
TABLE.."

> 
> I have 1GB+ free space on the drive where Derby db is being created :(
> What are the other reasons for the XSDF1 sql state?
> 

Other reasons may be that the file exists already. If you have the stack 
trace for the exception, we could check the source to see where it was 
thrown from.

Andreas

> Thanks and more power!
> 


Re: derby and torque transaction handling

Posted by Glenn Marintes <gl...@janet.co.jp>.
Hi Dan!
Thanks for your quick reply.
> Derby supports multiple connections. Other than that I'm not sure I can
> help. Does this tutorial help?
>   
I will verify Derby's multiple concurrent connections support then. I 
had got some info from one
of my superiors telling me that Derby does not support multiple 
concurrent Connections :(
Its best to try it out I think.

> http://db.apache.org/derby/integrate/db_torque.html
>   
Yes. I had read this tutorial.

Regarding Derby, I'm having some trouble with it.
I get an SQLException with "XSDF1" sql state when I try to 
executeQuery("CREATE TABLE <more ...>");

Its kinda weird because the same executeQuery call works on another test 
class. But when I run
the real app, I always get the XSDF1 exception. Please note that I have 
tried the execute() and executeUpdate()
too.

I have 1GB+ free space on the drive where Derby db is being created :(
What are the other reasons for the XSDF1 sql state?

Thanks and more power!

-- 
*******************************************
*
* Glenn M. Marintes
* Software Development Section
* JANET
*