none
Bulk Load problem - error connecting

    Question

  • I get the following error when trying to use the SQL Bulk Load object.

    "Error connecting to the data source."  The datasource is used right above this code to successfully read from the database.   It is the last line that blows up.

     

    Here is the problem code:

     

    connStr = "provider=SQLNCLI;Data Source=myserver;Initial Catalog=mydb;Integrated Security=True"

    Dim objBL As New SQLXMLBULKLOADLib.SQLXMLBulkLoad

     

    objBL.ConnectionString = connStr

    objBL.BulkLoad = True

    objBL.XMLFragment = True

    objBL.KeepIdentity = False

    objBL.ErrorLogFile = "C:\BulkLoadErrors.xml"

     

    objBL.Execute(SchemaFile, datafile)

     

    (SchemaFile and datafile are strings containing the full file name and path)

    Thursday, April 12, 2007 3:02 PM

Answers

  •  

    Use the connection string as follows :

    ConnStr = "provider=sqloledb;data source=myserver;database=mydb;integrated security=SSPI;"

    It should work.

     

    Thanks.

    Naras.

    Thursday, April 12, 2007 10:06 PM

All replies

  •  

    Use the connection string as follows :

    ConnStr = "provider=sqloledb;data source=myserver;database=mydb;integrated security=SSPI;"

    It should work.

     

    Thanks.

    Naras.

    Thursday, April 12, 2007 10:06 PM
  • Thank you!   That did it.  Annoying part is the connection string I was using was taken straight from the MSDN examples.
    Friday, April 13, 2007 11:56 AM