loader question
loader question
Hello,
I am loading a lot of records in my database at once from a text-file (244000 records).
But how to handele if one or more records conflicts with the primary key?
I like to skip those record, but the loader just drops all the records i try to add.
This way i will only work if the database is emty to start with.
Any suggestions how to solve this?
Thanks
Martijn Pijpers
I am loading a lot of records in my database at once from a text-file (244000 records).
But how to handele if one or more records conflicts with the primary key?
I like to skip those record, but the loader just drops all the records i try to add.
This way i will only work if the database is emty to start with.
Any suggestions how to solve this?
Thanks
Martijn Pijpers
Thank you for your reply,
Now i am trying to trap any error.
In order to do that i read the documentation, but i don't understand how to catch the errors with the following:
Public Delegate Sub PgSqlLoaderErrorEventHandler(ByVal sender As Object, ByVal e As PgSqlLoaderErrorEventArgs)
and
Public Event Error() As PgSqlLoaderErrorEventHandler
when i know the error then i want to decide to use e.ignore or not.
Please can you show me how to set up this error-hanling.
ps. i tried to use a try - catch routine but then i do not have the ignore property and many times the errors are not shown.
thank you in advance,
Martijn
Now i am trying to trap any error.
In order to do that i read the documentation, but i don't understand how to catch the errors with the following:
Public Delegate Sub PgSqlLoaderErrorEventHandler(ByVal sender As Object, ByVal e As PgSqlLoaderErrorEventArgs)
and
Public Event Error() As PgSqlLoaderErrorEventHandler
when i know the error then i want to decide to use e.ignore or not.
Please can you show me how to set up this error-hanling.
ps. i tried to use a try - catch routine but then i do not have the ignore property and many times the errors are not shown.
thank you in advance,
Martijn
Again thanks for your quick reply.
in the loaderdemo i only see :
Private Sub PgSqlLoader_Error(ByVal sender As System.Object, ByVal e As CoreLab.PostgreSql.PgSqlLoaderErrorEventArgs)
e.Ignore = True
End Sub
copying this does not work in my app.
after reading the documentation i think i need the
Public Delegate Sub PgSqlLoaderErrorEventHandler(ByVal sender As Object, ByVal e As PgSqlLoaderErrorEventArgs)
and
Public Event Error() As PgSqlLoaderErrorEventHandler
but i connot see how in the loader-demo.
Just to be clear about what i want:
I need the loader to insert many records 244000.
But when a primary key violation happens just ignore the error and go on with the next row.
To do that i need the e.ignore = true. (i Think).
So please tell if it is possible and how to do it.
Because inserting all those records with sql-statements will result in an out of memory errror from the Postgressql-server when reaching about 133000 records.
if you can solve the out of memory problem it is ok for me.
thank you in advance...
Martijn Pijpers
in the loaderdemo i only see :
Private Sub PgSqlLoader_Error(ByVal sender As System.Object, ByVal e As CoreLab.PostgreSql.PgSqlLoaderErrorEventArgs)
e.Ignore = True
End Sub
copying this does not work in my app.
after reading the documentation i think i need the
Public Delegate Sub PgSqlLoaderErrorEventHandler(ByVal sender As Object, ByVal e As PgSqlLoaderErrorEventArgs)
and
Public Event Error() As PgSqlLoaderErrorEventHandler
but i connot see how in the loader-demo.
Just to be clear about what i want:
I need the loader to insert many records 244000.
But when a primary key violation happens just ignore the error and go on with the next row.
To do that i need the e.ignore = true. (i Think).
So please tell if it is possible and how to do it.
Because inserting all those records with sql-statements will result in an out of memory errror from the Postgressql-server when reaching about 133000 records.
if you can solve the out of memory problem it is ok for me.
thank you in advance...
Martijn Pijpers
You should add PgSqlLoader_Error handler to the error. You can do this using Properties window or just make PgSqlLoader_Error procedure read:
Regarding this:
Code: Select all
Private Sub PgSqlLoader_Error(ByVal sender As System.Object, ByVal e As CoreLab.PostgreSql.PgSqlLoaderErrorEventArgs) Handles PgSqlLoader.Error
e.Ignore = True
End Sub
I don't think we can fix this. This is server problem. You need to upgrade your hardware I suppose.Because inserting all those records with sql-statements will result in an out of memory errror from the Postgressql-server when reaching about 133000 records.
if you can solve the out of memory problem it is ok for me.
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24