cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot Connect to New Database Server using ADO

SOLVED
Contributor

Re: Cannot Connect to New Database Server using ADO

The error occurs on the first instance of calling Qry[Execute], so the first loop where I call SELECT.

View solution in original post

Community Hero

Re: Cannot Connect to New Database Server using ADO

Ok... just something I'm looking at here. In the examples that I'm sering for using the ADO command objects, before the execute, the ADO Connection needs to be created and assigned to the object. I'm not in front of a PC to try it out yet but check out the examples at https://msdn.microsoft.com/en-us/library/ms675065(v=vs.85).aspx and see if that helps out.

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Cannot Connect to New Database Server using ADO

Creating the ADO Connection object seems to be redundant code, as you are just setting the Command Objects Connection String to the Connection object, and calling Execute opens the connection with the connection string set in the Command Object.

 

 

Community Hero

Re: Cannot Connect to New Database Server using ADO

Totally agree with that assessment. But comparing what you have with Microsofts published example, that seems to be the only major difference. Id at least give it a try. But I'll keep researching in the meantime

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Cannot Connect to New Database Server using ADO

Afraid using the connection object caused a log in prompt to appear when trying to connect even with the user info in the connection string.

 

It also caused an error I could not exit from, as a pop up window saying the thread was not synchronized would not close.

Community Hero

Re: Cannot Connect to New Database Server using ADO

Hrm... ok, then... thanks for trying.

I'm not certain, at this point, what the next step is. It seems that something within the permissions are blowing up.

Do you have access to the server side logs? Is there a way you can find out whether or not the server is receiving the correct information. Also, try writing out the connection string to the test log to make sure that nothing is getting sent improperly.

Perhaps someone else may have another direction to try.

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Contributor

Re: Cannot Connect to New Database Server using ADO

I was able to figure out the root cause of the issue with some help.

 

Turns out TestComplete likes to leave out "\" in strings, so putting \\ in my connection string got me connected properly.

View solution in original post

Community Hero

Re: Cannot Connect to New Database Server using ADO

That would do it.

FYI, that leaving out of the \ I'd actually a function of the language you are using. In some of the languages supported by TestComplete, that symbol is used to mark a special character like \' to actually print the single quote rather than terminate a string. So, to tell TC to actually include the \ character you need to double it up. I should have caught that in your earlier example.

Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: Cannot Connect to New Database Server using ADO

Just also make my connection string to '\\' and it works!

New Here?
Join us and watch the welcome video:
Top Kudoed Authors