Question

Custom FME database writer

  • 6 November 2013
  • 2 replies
  • 0 views

Hello everyone,

 

 

I have a question about FME behaviour. I am writing a custom SQL Spatial writer and managed to get it working (for inserts, updates and deletes are in the making), but there are some aspects of how my writer's methods are called that I can't get my head around.

 

 

Since it is a database writer I would have expected to see the startTransaction and commitTransaction methods getting called at some point, but this doesn't happen. I expected that specifying a writer type of DATABASE in the .db file would tell the FME what methods to call, but clearly my understanding of this isn't quite right. Can anyone out there shed some light on this for me?

 

 

Any tipps/ideas would be much appreciated.

 

 

Cheers,

 

Jan

2 replies

Userlevel 4
Hi,

 

 

If you're using the FME SQL Server writer, there is an automatic mechanism that handles periodic commits. This occurs for every 1000 feature written, by default. You can change this value under the Writer parameters.

 

 

If you need fine-grained control over how you write your features and how you handle transactions, consider using an SQLExecutor. It may be a bit more work, but is very flexible.

 

 

David
Hi David,

 

 

Thanks for your reply! I did contemplate using the SQLExecutor before I decided in favour of a custom writer. The main driver for this was that I thought it would be nicer to have a proper writer that can be configured just like the out of the box ones - Safe provide some sample code as part of the JAVA SDK that was really helpful with this.

 

 

Unfortunately my license level doesn't allow me to use the SQL Spatial writer that ships with FME, but the non-spatial SQL writer is whre I saw the transaction parameters - now I'm trying to figure out how to make my writer work in transaction mode, too.

 

 

Cheers,

 

Jan 

Reply