|
Home > Archive > SQL Anywhere ultralite > April 2006 > ServerContext.makeConnection
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ServerContext.makeConnection
|
|
| Brent Williams 2006-04-04, 11:24 am |
| I'm running v9.0.2.3249
I'm trying to figure what connection is returned from the
ServerContext.makeConnection() method. Is this a new connection and not
the one currently being used for the upload or download? The docs make
it sound like it is a new connection. If so, is it set to autoCommit or
not? If I were to call this method during upload and use that
connection to insert into a table what should happen if the upload fails
and rolls back. I got the impression that the inserts with this new
connection would stay and not roll back but that is not happening.
| |
| Brent Williams 2006-04-04, 11:24 am |
| Sorry...I sent this to the wrong group. I'll leave it here so it
doesn't look like I cross posted.
Brent Williams wrote:
> I'm running v9.0.2.3249
>
> I'm trying to figure what connection is returned from the
> ServerContext.makeConnection() method. Is this a new connection and not
> the one currently being used for the upload or download? The docs make
> it sound like it is a new connection. If so, is it set to autoCommit or
> not? If I were to call this method during upload and use that
> connection to insert into a table what should happen if the upload fails
> and rolls back. I got the impression that the inserts with this new
> connection would stay and not roll back but that is not happening.
| |
| Greg Fenton 2006-04-05, 11:25 am |
| Brent Williams wrote:
> The docs make
> it sound like it is a new connection.
I'm pretty sure it is a new connection.
> If so, is it set to autoCommit or not?
It likely has the same properties as the connection that ML uses, which
would *not* be autocommit. But the best thing to do would be to
explicitly set any properties your application needs once you have the
connection.
> If I were to call this method during upload and use that
> connection to insert into a table what should happen if the upload fails
> and rolls back.
The rollback of the upload will not affect the transaction in this other
connection. Your code should be managing that connection's transaction.
Of course, if you do not commit and the sync fails, you need another
script to clean up that connection otherwise it will rollback (any
uncommitted transaction automatically rolls back if the connection
terminates).
> I got the impression that the inserts with this new
> connection would stay and not roll back but that is not happening.
Are you explicitly committing?
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
| Brent Williams 2006-04-05, 11:25 am |
| I went back and added a commit and that fixed the problem. I'm used to
working with connections set to auto commit by default. Also, the
failed upload (rollback) does not affect this new connection.
Thanks
Greg Fenton wrote:
> Brent Williams wrote:
>
>
>
> I'm pretty sure it is a new connection.
>
>
>
> It likely has the same properties as the connection that ML uses, which
> would *not* be autocommit. But the best thing to do would be to
> explicitly set any properties your application needs once you have the
> connection.
>
>
>
> The rollback of the upload will not affect the transaction in this other
> connection. Your code should be managing that connection's transaction.
>
> Of course, if you do not commit and the sync fails, you need another
> script to clean up that connection otherwise it will rollback (any
> uncommitted transaction automatically rolls back if the connection
> terminates).
>
>
>
> Are you explicitly committing?
>
> greg.fenton
| |
| Greg Fenton 2006-04-05, 1:28 pm |
| Brent Williams wrote:
> I went back and added a commit and that fixed the problem. I'm used to
> working with connections set to auto commit by default.
Yes, I hate autocommit too ;-)
> Also, the failed upload (rollback) does not affect this new connection.
Great to hear!
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
|
|
|
|
|