none
Error when creating a database on SQL Server 2012(Virtual Machine)

    Question

  • Hi,

     

    I create a virtual machine on VMWare Workstation 10, then install Windows 7(32bit), then install SQL Server 2012 Enterprise version.

     

    Then I write a Visual C++2008 program and using ADO to connect to the local SQL Server, with the connection string below:

     

    “Provider=sqloledb;Data Source=(local);Integrated Security=SSPI;”

     

    The connect succeed, then I try to create a new SQL Server database by calling:

     

    m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘E:\\MyDatabase.mdf’)”), NULL, 0);

     

    where E: is a USB drive plugged in.

     

    When running the above statement, I can even see the MyDatabase.mdf file is being created, but finally get an error and error number is 80040e31 when checking the error from m_pConnection, after analyzing the com exception, we find it reports the error as “IDispath error #3121”. Both errors seem to indicate a “Timeout error”.

     

    Then I try to create the database on the local drive in the virtual machine, as follows:

     

    m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘C:\\MyDatabase.mdf’)”), NULL, 0);

     

    Then I get error number: 80040e14 from m_pConnection, and com error is “IDispath error #3092”

     

    What is the problem?

     

    Thanks

    Wednesday, March 05, 2014 3:56 PM

Answers