473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

OleDb DataFactory bug. Watch out.

Bob
Hi,
Using the OleDb factory.
Asked it to insert 4K records into a SQLAnywhere database table.
Runs out of steam at record 244 and starts writing corrupted versions of
243 primary index column until at 248 it hits a variation it has already
written and fails with a non-unique primary index error.

Use a hand rolled OleDb command and the data is written OK. Likewise the SQL
Factory writes the same data to an SQLServer OK.

It is not a race condition as you can step through the failing iteration and
it still fails.
So...
Stay away from the OleDb Data factory until it is repaired.
Bob


Nov 16 '06 #1
4 1828
Bob,

I almost would NEVER use the OleDbFactory class to generate commands for
me. SqlFactory is one thing, since it is tailored specifically for Sql
Server. However, OleDb has to deal with a plethora of different providers
(the same thing applies for the OdbcFactory as well).

Are you writing a general-purpose tool, or are you writing something
more specific?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bob" <bo*@nowhere.comwrote in message
news:O7**************@TK2MSFTNGP03.phx.gbl...
Hi,
Using the OleDb factory.
Asked it to insert 4K records into a SQLAnywhere database table.
Runs out of steam at record 244 and starts writing corrupted versions of
243 primary index column until at 248 it hits a variation it has already
written and fails with a non-unique primary index error.

Use a hand rolled OleDb command and the data is written OK. Likewise the
SQL
Factory writes the same data to an SQLServer OK.

It is not a race condition as you can step through the failing iteration
and
it still fails.
So...
Stay away from the OleDb Data factory until it is repaired.
Bob


Nov 16 '06 #2
Bob
Hi Nicholas,
Thanks for your reply.
The app has to sit on top of either an SQlserver db or an SQLAnywhere db.
The idea of generic calls in the Dataclass was obviously appealing.
Narrowed it down in fact not to the factory, but to the DbParameter

When using the factory I was getting a generic DbParameter and setting its
DbType property to string. The corruption occured.

When I was not using the factory I was declaring an OleDbParameter and
setting its OleDbType property to Varchar. The data imported.

I found that if I didn't use the factory and declared an OleDbParameter and
only set its dbType property to String it gave the corruption.

Inspection of the OleDbType property in this situation showed that it had
been set to VarWChar by the Framework (the tooltip shows that VarWChar maps
to System.String)

I then set the OleDbParameter OleDbType to VarWChar and was able to bring
the corruption on.

So exactly how deep the weakness is remains unclear. It may be the
SqlAnywhere drivers.
Time for a cuppa coffee and a rethink.
regards
Bob

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:Oq**************@TK2MSFTNGP03.phx.gbl...
Bob,

I almost would NEVER use the OleDbFactory class to generate commands
for
me. SqlFactory is one thing, since it is tailored specifically for Sql
Server. However, OleDb has to deal with a plethora of different providers
(the same thing applies for the OdbcFactory as well).

Are you writing a general-purpose tool, or are you writing something
more specific?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bob" <bo*@nowhere.comwrote in message
news:O7**************@TK2MSFTNGP03.phx.gbl...
Hi,
Using the OleDb factory.
Asked it to insert 4K records into a SQLAnywhere database table.
Runs out of steam at record 244 and starts writing corrupted versions
of
243 primary index column until at 248 it hits a variation it has already
written and fails with a non-unique primary index error.

Use a hand rolled OleDb command and the data is written OK. Likewise the
SQL
Factory writes the same data to an SQLServer OK.

It is not a race condition as you can step through the failing iteration
and
it still fails.
So...
Stay away from the OleDb Data factory until it is repaired.
Bob




Nov 16 '06 #3
Bob
Hi Nicholas,
re my previous reply.
Had the cuppa coffee.
decided to test for factory type.(I am using DbProviderFactories)
If System.Data.OleDb.OleDbFactory then I cast the sensitive DbParameter as
an OleDbParameter and set its OleDbType to VarChar.
Otherwise just set the DbType to String.
regards
Bob
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:Oq**************@TK2MSFTNGP03.phx.gbl...
Bob,

I almost would NEVER use the OleDbFactory class to generate commands
for
me. SqlFactory is one thing, since it is tailored specifically for Sql
Server. However, OleDb has to deal with a plethora of different providers
(the same thing applies for the OdbcFactory as well).

Are you writing a general-purpose tool, or are you writing something
more specific?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bob" <bo*@nowhere.comwrote in message
news:O7**************@TK2MSFTNGP03.phx.gbl...
Hi,
Using the OleDb factory.
Asked it to insert 4K records into a SQLAnywhere database table.
Runs out of steam at record 244 and starts writing corrupted versions
of
243 primary index column until at 248 it hits a variation it has already
written and fails with a non-unique primary index error.

Use a hand rolled OleDb command and the data is written OK. Likewise the
SQL
Factory writes the same data to an SQLServer OK.

It is not a race condition as you can step through the failing iteration
and
it still fails.
So...
Stay away from the OleDb Data factory until it is repaired.
Bob




Nov 16 '06 #4
Bob,

For what it's worth, OLEDB is a ton more finicky than the SQL Server
libraries, largely because of the lower level library implementations.
I was doing some Sybase access a while back with the Intersolv drivers
(the Sybase drivers that come with the .NET framework), and I had a
whole pile of problems. Named parameters didn't work at all, not to
mention that SP calls made you jump through hoops, and multiple
recordset results would hang on NextRecordset() when you got to the
last recordset. Unless you got everything perfect, it would crash in a
sometimes unpredictable way.

I assume you can't use the regular SQL Server access mechanisms for
some reason. If that's not the case, use them and save yourself the
heartache.
Stephan

Bob wrote:
Hi Nicholas,
re my previous reply.
Had the cuppa coffee.
decided to test for factory type.(I am using DbProviderFactories)
If System.Data.OleDb.OleDbFactory then I cast the sensitive DbParameter as
an OleDbParameter and set its OleDbType to VarChar.
Otherwise just set the DbType to String.
regards
Bob
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:Oq**************@TK2MSFTNGP03.phx.gbl...
Bob,

I almost would NEVER use the OleDbFactory class to generate commands
for
me. SqlFactory is one thing, since it is tailored specifically for Sql
Server. However, OleDb has to deal with a plethora of different providers
(the same thing applies for the OdbcFactory as well).

Are you writing a general-purpose tool, or are you writing something
more specific?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bob" <bo*@nowhere.comwrote in message
news:O7**************@TK2MSFTNGP03.phx.gbl...
Hi,
Using the OleDb factory.
Asked it to insert 4K records into a SQLAnywhere database table.
Runs out of steam at record 244 and starts writing corrupted versions
of
243 primary index column until at 248 it hits a variation it has already
written and fails with a non-unique primary index error.
>
Use a hand rolled OleDb command and the data is written OK. Likewise the
SQL
Factory writes the same data to an SQLServer OK.
>
It is not a race condition as you can step through the failing iteration
and
it still fails.
So...
Stay away from the OleDb Data factory until it is repaired.
Bob
>
>
>
>
Nov 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Thunell | last post by:
I have a program where i connect to an access database and get some information out of it. I'm using the oledb.3.51 version, my computer doesn't seem to have the 4.0 version, but the computer that...
12
by: Parking Meters | last post by:
Today I managed to get the OleDB provider to let me put datasets from an as400 using sql. Great, the provider string I used is: Provider=IBMDA400.DataSource.1;User ID=XXXXX;Password=XXXX;Data...
4
by: NS | last post by:
Hi, I am trying to execute a prepare statement using oledb provider for DB2. The command.Prepare() statement is giving me an exception " No error information available:...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
1
by: T8 | last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
1
by: Chriz Yuen | last post by:
Sub Button1_Click(sender As Object, e As EventArgs) Dim ConnectionString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("EzySys.mdb") & ";" Dim myConn As New...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.