New Posts New Posts RSS Feed: Pervasive PSQL Provider and Enlist Transaction
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Pervasive PSQL Provider and Enlist Transaction

 Post Reply Post Reply
Author
thecotton View Drop Down
Newbie
Newbie
Avatar

Joined: 07-Mar-2008
Location: United States
Posts: 8
Post Options Post Options   Quote thecotton Quote  Post ReplyReply Direct Link To This Post Topic: Pervasive PSQL Provider and Enlist Transaction
    Posted: 08-Jan-2011 at 9:38pm
The Pervasive PSQL .Net provider 3.5 is compatible with EF2 and Framework 4 EXCEPT that it does not currently support distributed transactions - only local transactions. It works fine with the VS 2010 entity data model (ie, without Devforce EF), but I have had zero success getting it to work with Devforce. If I set the connection to enlist transactions, I get an exception of "The underlying provider failed on open" with inner exception "Specified method is not supported" as was expected from Pervasive documentation. When I set the connection NOT to enlist transactions, I get exception from Ideablade.EntityModel  "The underlying provider failed on Enlist Transaction". I have tried setting TransactionSettings to change UseTransactionScope to false, but I srill get the same error. Checking the Pervasive trace log, it would appear that the Pervasive provider did not throw the error - it just shows to have opened the connection and then closed it when I stop the debugger.
 
What can I do to allow use of the PSQL provider without enlisting transactions? Again, when used with the entity framework modeler alone, it works OK.
 
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 13-Jan-2011 at 5:42pm
Hi thecotton,
 
Where are you setting UseTransactionScope?
(I'm assuming you are using
TransactionSettings.Default = new TransactionSettings (System.Transactions.IsolationLevel.ReadCommitted, new TimeSpan(0, 1, 0), false);
if not let me know how you are setting it)
 
Also, could you verify that UseTransactionScope is set to false right before the save/query throwing the exception?
(i.e.
var queryTransactional = mgr.DefaultQueryStrategy.TransactionSettings.UseTransactionScope;
var saveTransactional = mgr.DefaultSaveOptions.TransactionSettings.UseTransactionScope;
)
 
Silvio.
Back to Top
thecotton View Drop Down
Newbie
Newbie
Avatar

Joined: 07-Mar-2008
Location: United States
Posts: 8
Post Options Post Options   Quote thecotton Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jan-2011 at 6:02pm
I am setting as follows:
Imports IbEm = IdeaBlade.EntityModel
Imports IbCore = IdeaBlade.Core
Imports DevForceTest.TrackerEntities
Public Class TrafficForm
Dim qts As New IbEm.TransactionSettings(Transactions.IsolationLevel.ReadCommitted, New TimeSpan(0, 0, 15), False)
Dim ts As New IbEm.TransactionSettings(Transactions.IsolationLevel.ReadCommitted, New TimeSpan(0, 0, 15), False)
Dim WithEvents Tracker As New DevForceTest.TrackerEntities
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TrackerEntities.DefaultManager.DefaultQueryStrategy = TrackerEntities.DefaultManager.DefaultQueryStrategy.With(qts) ‘ adding this line fixed problem
TrackerEntities.DefaultManager.DefaultSaveOptions.TransactionSettings = ts
TrackerEntities.DefaultManager.Connect()
Try
Me.TrafficBindingSource.DataSource = _
Tracker.Traffics.OrderBy(Of Integer)(Function(Traffic) Traffic.TrafKey).ToList()
Catch ex As Exception
Debug.Print(ex.Message)
End Try
End Sub

Private Sub Tracker_Saving(ByVal sender As Object, ByVal e As IdeaBlade.EntityModel.EntitySavingEventArgs) Handles Tracker.Saving
Debug.Print("Saving")
End Sub
End Class
I discovered that I was setting DefaultSaveOptions.TransactionSettings, but had failed to set TransactionSettings for DefaultQueryStrategy. Now that I am setting both, the connection error has gone away. I also picked up your much-more-understandable TransactionSettings.Default, which would have done away with much of my code.

Now if I can only figure out why it is not saving changes, I may get this worked out....
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2011 at 10:35am
Hi thecotton,
 
I'm glad you solved the first issue.
What problem are you having while trying to save changes?
Back to Top
thecotton View Drop Down
Newbie
Newbie
Avatar

Joined: 07-Mar-2008
Location: United States
Posts: 8
Post Options Post Options   Quote thecotton Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jan-2011 at 9:26pm

I needed to make a PSQL connection to the database before the save (and that's also where I needed to do the PSQL BeginTransaction, but that wouldn't have prevented saving changes). No hill for a climber. I'm just now beginning to get a feel for what needs to be done. I have just been making things too complicated....

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down