Showing posts with label succesfully. Show all posts
Showing posts with label succesfully. Show all posts

Tuesday, March 27, 2012

Can't change the name of a OLE DB Source component name

Hi,

I've created an application that create package with a dataflow. The package with the dataflow and the ole db Source was created succesfully but for some reason the name of the Ole DB Source dosen't change programmitcally It's stays with the default name "OLE DB Source". This is very problematic because I want to add another Ole Db source and the package won't load because there will be two components with the same name.

Thanks.

This is the Code, It's from msdn exmples:

Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

Module Module1

Sub Main()

Dim package As Microsoft.SqlServer.Dts.Runtime.Package = _
New Microsoft.SqlServer.Dts.Runtime.Package()
Dim e As Executable = package.Executables.Add("DTS.Pipeline.1")
Dim thMainPipe As Microsoft.SqlServer.Dts.Runtime.TaskHost = _
CType(e, Microsoft.SqlServer.Dts.Runtime.TaskHost)
Dim dataFlowTask As MainPipe = CType(thMainPipe.InnerObject, MainPipe)

' Add an OLEDB connection manager to the package.
Dim cm As ConnectionManager = package.Connections.Add("OLEDB")
cm.Name = "OLEDB ConnectionManager"
cm.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=AdventureWorks;Provider=SQLOLEDB.1;" & _
"Integrated Security=SSPI;"

' Add an OLE DB source to the data flow.
Dim component As IDTSComponentMetaData90 = _
dataFlowTask.ComponentMetaDataCollection.New()
component.Name = "AdventureWorks;Product"
component.ComponentClassID = "DTSAdapter.OleDbSource.1"
' You can also use the CLSID of the component instead of the PROGID.
'component.ComponentClassID = "{2C0A8BE5-1EDC-4353-A0EF-B778599C65A0}";

' Get the design time instance of the component.
Dim instance As CManagedComponentWrapper = component.Instantiate()

' Initialize the component.
instance.ProvideComponentProperties()

' Specify the connection manager.
If component.RuntimeConnectionCollection.Count > 0 Then
component.RuntimeConnectionCollection(0).ConnectionManager = _
DtsConvert.ToConnectionManager90(package.Connections(0))
End If

' Set the custom properties.
instance.SetComponentProperty("AccessMode", 2)
instance.SetComponentProperty("SqlCommand", _
"Select * from Production.Product")

' Reinitialize the metadata.
instance.AcquireConnections(vbNull)
instance.ReinitializeMetaData()
instance.ReleaseConnections()

' Add other components to the data flow and connect them.

End Sub

End Module

If I remember correctly, the Name should be set after the call to

instance.ProvideComponentProperties();

|||Thanks It works

Sunday, March 11, 2012

Cannot use Windows Authentification over VPN

Hi,
I'm trying to connect to my SQL Server 2000 over a VPN IPsec. The VPN
connects succesfully, I can browse with the Windows Explorer the shared
folders of my SQL Server.
When I ping the server the servername is resolved, and when I use ping
-a also resolve the dns.
My problem is the connection to the SQL Server with Windows
Authentification, the following error is throwed:
"Unable to connecto to server...
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Dirver] Cannot generate SSPI context"
But when I use SQL Authentication works fine.
Can anyone help me please?
Thanks in advance,
David SHi guys...
Doing some test I think I know where is the problem.
As I describe in the past post, I'm using a Client VPN aplication to
communicate a mobile user to the main app in the hq. The things is that the
mobile user log in to his domain account when the VPN is not yet established
,
so the DC doesn’t finds out when the user log in.
Once the VPN is up a running the user can access the different shared
folders. But when I try to connect to my app with SQL Server and Windows
Authentication, the app throws the following error: “Cannot generate SSPI
context”.
Is there any way to re-login once you have log onto your account or
just to establish a connection with the DC?
Thanks for your help,
David S|||Working on exactly the same problem. Have you been able to resolve the
issue?
Maybe changing to named pipes? It did not work for me. Also, you can
use sql authentication and you should connect - unfortunately it is
not an option for me. Need to use windows authentication over ipsec.|||Are you signing in to Windows through a VPN or starting a VPN connection
after you're signed in? You could try creating a User with the same
usercode and password as the user you use to sign in to the VPN, then sign
in to Windows with that user and then make your VPN connection and
connection to SQL that May work..
Mike Bulava, MCDBA
"dk77" <dk77@.aa-dot-com.no-spam.invalid> wrote in message
news:e5qdnXM6DIJiKgvfRVn_vg@.giganews.com...
> Working on exactly the same problem. Have you been able to resolve the
> issue?
> Maybe changing to named pipes? It did not work for me. Also, you can
> use sql authentication and you should connect - unfortunately it is
> not an option for me. Need to use windows authentication over ipsec.
>

Cannot use Windows Authentification over VPN

Hi,
I'm trying to connect to my SQL Server 2000 over a VPN IPsec. The VPN
connects succesfully, I can browse with the Windows Explorer the shared
folders of my SQL Server.
When I ping the server the servername is resolved, and when I use ping
-a also resolve the dns.
My problem is the connection to the SQL Server with Windows
Authentification, the following error is throwed:
"Unable to connecto to server...
ODBC: Msg 0, Level 16, State 1
[Microsoft][ODBC SQL Server Dirver] Cannot generate SSPI context"
But when I use SQL Authentication works fine.
Can anyone help me please?
Thanks in advance,
David S
Hi guys...
Doing some test I think I know where is the problem.
As I describe in the past post, I'm using a Client VPN aplication to
communicate a mobile user to the main app in the hq. The things is that the
mobile user log in to his domain account when the VPN is not yet established,
so the DC doesn’t finds out when the user log in.
Once the VPN is up a running the user can access the different shared
folders. But when I try to connect to my app with SQL Server and Windows
Authentication, the app throws the following error: “Cannot generate SSPI
context”.
Is there any way to re-login once you have log onto your account or
just to establish a connection with the DC?
Thanks for your help,
David S
|||Working on exactly the same problem. Have you been able to resolve the
issue?
Maybe changing to named pipes? It did not work for me. Also, you can
use sql authentication and you should connect - unfortunately it is
not an option for me. Need to use windows authentication over ipsec.
|||Are you signing in to Windows through a VPN or starting a VPN connection
after you're signed in? You could try creating a User with the same
usercode and password as the user you use to sign in to the VPN, then sign
in to Windows with that user and then make your VPN connection and
connection to SQL that May work..
Mike Bulava, MCDBA
"dk77" <dk77@.aa-dot-com.no-spam.invalid> wrote in message
news:e5qdnXM6DIJiKgvfRVn_vg@.giganews.com...
> Working on exactly the same problem. Have you been able to resolve the
> issue?
> Maybe changing to named pipes? It did not work for me. Also, you can
> use sql authentication and you should connect - unfortunately it is
> not an option for me. Need to use windows authentication over ipsec.
>

Thursday, March 8, 2012

Cannot update. Database or object are read-only

I have to build application Excel (interface) - SQL Server (backend)

I've created Data Source File "test.dsn" and tested succesfully.
SQL Server database in on the other machine.
This is a code that I am using.

And error message I am geting is "Cannot update. Database or object are read-only".

Dim cn As ADODB.Connection
Dim strSQL As String

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\pd\Desktop\Development\test.xls;" & _
"Extended Properties=Excel 8.0"


strSQL = "INSERT INTO [DSN = test.dsn].Region Values(5, 'ab');"


cn.Execute strSQL

cn.Close
Set cn = Nothing

Read-only of databse properties is not selected.If I get it right you're attempting to insert a row into excel. As long as I know it's not possible because you cannot update, insert records throught Jet provider. mojza|||Your query is unclear . Understanding you are trying to update region table In sql database .
if that's case you should then rather open an ODBC or OLE DB connection to SQL server

cn.Provider = "sqloledb"
cn.Properties("Data Source") = ServerName
cn.Properties("Initial Catalog") = DatabaseName

' If Windows NT authentication.
cn.Properties("Integrated Security")= "SSPI"

'If SQL Authentication
cn.Properties("User ID")= UserID
cn.Properties("Password") = pwd

' Open the database.
cn.Open

Dim strSQL as string

strSQL "INSERT INTO dbo.Region Values(5, 'ab')"

cn.execute strSQL

cn.close
set cn = nothing