Ask a questionAsk a question
 

AnswerScript Component and OLEDB Connection

  • Tuesday, January 15, 2008 3:20 AMJerry9988 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    Hi

    I am using OLEDB Connection in script component. I get a login failure when I run the package. I use SQL Server authentication. Do you have to use windows authentication in script component? Thanks

     

Answers

  • Tuesday, January 15, 2008 3:45 AMjwelchModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No, you can use SQL authentication. What code are you using to get the connection?

     

  • Tuesday, January 15, 2008 6:59 PMjwelchModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    You should use the MyConnection.AquireConnection method to get the connection object - you'll probably need to use an ADO.NET connection manager, otherwise you'll get a COM object back.

     

    If you use AquireConnection, it will handle the password for you. Of course, I'm assuming that you do have the password being set through a configuration or that it is stored in the package.

     

    You might check this article out for an overview of how to do this:

    http://technet.microsoft.com/en-us/library/aa337080.aspx

     

All Replies

  • Tuesday, January 15, 2008 3:45 AMjwelchModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    No, you can use SQL authentication. What code are you using to get the connection?

     

  • Tuesday, January 15, 2008 3:52 PMJerry9988 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I used

    .Connection = New OleDbConnection(Connections.MyConnection.ConnectionString)

    because Connections.MyConnection.ConnectionString  dose not include the password, it did not work. Now I am using

    Connection = New OleDbConnection(Connections.MyConnection.ConnectionString + "Password=" + Variables.TorqueDWPwd + ";")

     

    it works. But I am not sure if this is the best way to do

     

    The ConnectionString is stored in the database table like Microsoft Project REAL. In Microsoft Project REAL, it uses windows authentication. I don't want to use windows authentication here.

     

  • Tuesday, January 15, 2008 6:59 PMjwelchModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    You should use the MyConnection.AquireConnection method to get the connection object - you'll probably need to use an ADO.NET connection manager, otherwise you'll get a COM object back.

     

    If you use AquireConnection, it will handle the password for you. Of course, I'm assuming that you do have the password being set through a configuration or that it is stored in the package.

     

    You might check this article out for an overview of how to do this:

    http://technet.microsoft.com/en-us/library/aa337080.aspx

     

  • Wednesday, November 04, 2009 8:48 AMNecati ARSLAN Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed AnswerHas Code
    You can use this code.

            Dim cmParams As Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSConnectionManagerDatabaseParameters100 = CType(DtsConvert.GetWrapper(Me.Connections.EtlLog).InnerObject, Wrapper.IDTSConnectionManagerDatabaseParameters100)
            Dim objConnection As OleDbConnection = CType(cmParams.GetConnectionForSchema(), OleDbConnection)

    then you can use oldb Connection
    • Proposed As Answer byNecati ARSLAN Wednesday, November 04, 2009 10:20 AM
    •