Unable to connect to my local db
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unable to connect to my local db
Error thrown when I am trying to restore my local DB using ADO object available in Testcomplete
Here is my full script
(Written in Jscript)
var con,query,result; con=ADO.CreateADOConnection(); con.ConnectionString = "Provider=SQLNCLI11;Server=mylocalserver;Database=MyLocalDB;Integrated Security=True;DataTypeCompatibility=80;Uid=sa;Pwd=123123;"; con.Open(); query=ADO.CreateADOQuery(); query.SQL="RESTORE DATABASE MyLocalDB FROM DISK = 'C:\\Test\\TestsBackup\\Data\\DB\\MyLocalDB.bak' WITH REPLACE"; query.Active=con; result=query.ExecSQL(); con.Close();
When executing throws an below error,
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
a) The message does not say that ADO cannot connect to the database. It says that the system is out of resources. It's better to reboot.
b) ADO Query object assumes that a recordset is returned, while your SQL will not return a recordset. Not sure about ADO wrapper in TestComplete, but in 'pure' ADO you should use Command object instead of Recordset in this case.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for sharing your suggestions, Alex.
@DKumar04, did Alex reply help you overcome the error message? If it did, please accept his reply as a solution.
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the post Alex.
Still issue not sorted out.
Please post me the JScript for restoring my local db
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As one of possible options: https://support.smartbear.com/viewarticle/8968/
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
best way you can use sqlcmd by creating sql file to restore database and run it from batch cmd
add that batch file in the testcomplete.
