We have a package on Server A which we use to load the data into different databases on different Servers. We just change the destination Connection through "SQL Server 2008 Integration Services Package Execution Utility". When the package loads the data it sends a confirmation Email with a subject of "package name and time" that data has been loaded successfully. I want to add the destination connection (Server name and database name) in the subject to make sure the data is loading into the right destination.
Any help is greatly appreciated.
The easiest way to do this would be to use a script task to load the information into a variable.
I am assuming that if you are dynamically setting your connection that you have the connection string stored as a variable.
If so you can use the SqlConnectionStringBuilder() class in .net.
var connstring = DTS.Variables["Yourvariablehere"].Value.ToString();
var builder = new SqlConnectionStringBuilder(connstring);
DTS.Variables["servervariablehere"].Value = builder.DataSource;
DTS.Variables["databasevariablehere"].Value = builder.InitialCatalog;
Related
I have a local SQL DB and an Azure SQL DB. In my data flow I am trying to pass data from local (ole db source) to Azure (ole db destination).
I am unable to save the password for the connection string so I have parameterized the connection string of the data flow task but I seem unable to work out how to get the destination to use it?
I know this isn't best practice but I just want to prototype a few things. Is this possible?
Thanks
Double click project params and add your connection string as a parameter. Give it any name you want, select string then paste your Azure connection string that you have copied directly from you Azure portal connection string option.
This creates a project level conn string parameter.
Right click connection managers and create a new ADO.Net connection manager. This should be fairly straightforward.
Once completed, select this connection manager and add an expression to it from the property window:
In the Property Expression Editor: (1) Select a property called ConnectionString. (2) Select the elipsis beside expression. From the pop up open the project parameters in the left hand area and you will see the connection parameter you created earlier. Drag this into the expression text area. Evaluate the expression to check it works.
Click OK
You should now be able to use this as an Azure connection without getting any errors
I am using a TableAdapter in a dataset in Vb.net winforms (connected to a mysql server) to allow integration of a Devexpress scheduler - I have been using this method for some time; while I know of many of the security flaws of vb.net including decompiling and packet sniffing plain text communication; I am trying to lock down security as much as I can which brings me to my current problem.
The dataset was set up to connect using the .net framework data provider for mysql which requests a Server address, username, password, and DB file - I then get the option of "saving the login credentials in the connection string" or "setting the login credentials in my programming code" for sake of time previously I saved the login credentials.
this adds a setting file (connectionstring)
server=mysqlserveraddress.com;user id=mysqluser;password=mysqlpassword;database=mysqldb;persistsecurityinfo=True
which also means these credentials are saved in plain text in the installation folder for my program
I am trying to transition to including this connectionstring in my programming code however I do not know how to approach it - for non-dataset transactions I have already declared public const in a module which includes the credentials
'database variables
Public Const dbserver As String = "mysqlserveraddress.com"
Public Const dbuser As String = "mysqluser"
Public Const dbpassw As String = "mysqlpassword"
Public Const dbfile As String = "mysqldb"
and I create the connections when needed.
How do I programmatically enter the connection string so it is not visible to the lay-person.
Are you saying that you want to to set the user id and password attributes of an existing connection string at run time? If so then you can use the appropriate connection string builder. I don't use MySQL and Connector/Net but it should look something like this:
Dim builder As New MySqlConnectionStringBuilder(partialConnectionString)
builder.UserId = userId
builder.Password = password
Dim fullConnectionString As String = builder.ConnectionString
Anyone who decompiles your code is going to see that data though. You might consider just storing the whole lot in the config file but encrypting it. For more info on that, check this out:
http://www.vbforums.com/showthread.php?532768-NET-2-0-Protected-Configuration-(Encrypting-Config-Files)
I have a Web Service Task in a dtsx package developed in Visual Studio. It has an httpconnection with a Timeout setting of 30 seconds. The package is included as a step in a sql server (2008 r2) agent job. When I deployed the package, I set it up to be stored in SQL Server.
I would like to be able to change just the Timeout setting in the sql job step, but I'm not sure how to do this or even if it's possible. At the moment I'm changing the setting within VS then redeploying the package each time.
Can anyone give me any help on how to do this? Which tab of the job step should this be set on?
One thing to be aware of, there is the timeout property on the HTTP Connection Manager but that's for controlling the actual connection to the web service. It does not control the actual time for invoking a particular method, if that makes sense.
I had a 2005 package that consumed a web service for cleaning addresses. The webservice was hosted internally so the HTTP Connection was as LAN speeds, no issue there. The service itself could standardize one address pretty quick. When I need to bulk clean a few hundred thousand, then it takes a not insignificant amount of time. The XML task has a built in, as of 2008 R2, unchangable default timeout of 6 minutes. That's not so handy if you need it to be 3601 seconds or never time out. I'm having trouble finding documentation calling that out but you can verify the behaviour by ginning up a service that sleeps for 6+ minutes.
Our resolution was to use a script task to handle the actual service call so that we could override the Timeout property for the service call.
Public Sub Main()
Dim url As String
Dim inboundFile As String
Dim success As Boolean
Dim timeoutMs As Integer
' 1 hour = 60min * 60 sec * 1000 milliseconds
timeoutMs = 60 * 60 * 1000
inboundFile = CStr(Dts.Variables("NetworkShareInput").Value)
url = CStr(Dts.Variables("WebService").Value)
Try
Dim svc As New AddressCleanerService(url)
' Explicitly provide a timeout for the web service connection
svc.Timeout = timeoutMs
svc.Credentials = System.Net.CredentialCache.DefaultCredentials
success = svc.CleanBulkAddresses(inboundFile)
Catch ex As Exception
Dts.Events.FireError(0, "Address cleaning", "Something failed in the address component stuff", String.Empty, 0)
Dts.Events.FireError(0, "Address cleaning", ex.ToString(), String.Empty, 0)
End Try
If (success) Then
Dts.TaskResult = ScriptResults.Success
Else
Dts.TaskResult = ScriptResults.Failure
End If
End Sub
One way to do it is to use expressions and pass the timeout value from sql agent job. Below are highlevel steps:
Create a variable in your SSIS package to hold the timeout value.
In the properties window of the HTTP connection, click on the expressions eclipse button.
Expand Property dropdown in the property expression editor. Select Timeout.
And use the timeout variable you created earlier. Something like: #[User::Timeout]
In SQL Agent, use command line as job type, and use DTEXEC to execute the SSIS package.
In the DTEXEC command you can pass values to variables. Below is a commad example:
dtexec /f C:\SSIS\Package.dtsx /set \package.variables[Timeout].Value;45
So, when you want to change the timeout value simple change it in the SQL Agent job instead of redeploying the package.
First, if you still have control over the source code, I would point you to package configurations. Then you can edit these settings in an XML file or a data table.
Assuming you don't, you can push some values into the package using the "Set Values" tab of the job step. The hard part is getting the property path correct. Again, using Visual Studio and the package configurations feature, you should be able to find the right name.
Try this for the property path: \Package.Connections[myHttpConnection].Properties[Timeout].Value
I have a simple SSIS Package, which has
a Excute SQL Task control on the Control Flow, which fetches some value from the database
In the DataFlow, am using a Script Component, which based on values given by 'Excute SQL Task', does this:
public override void CreateNewOutputRows()
{
try
{
string loginURL = "http://maps.googleapis.com/maps/api/geocode/xml?address=" + Variables.ProjectAddress + "&sensor=true";
WebClient client = new WebClient();
string downloadString = client.DownloadString(loginURL);
XmlDocument xml = new XmlDocument();
xml.LoadXml(downloadString);
///// setting output buffer variables
}
catch(Exception ex)
{
}
}
so basically am requesting a web service for latitude and longitude inside the package.
The retrieved values are then updated into the database:
Everything works fine, when I run the package from the Visual Studio SSIS project console.
But when I try to run the package through a SQL Server 2008 R2 Job, nothing happens. Job Executes successfully but no rows are updated(or inserted).
I tried importing the package into SQL MSDB and setting the protection level to all the items in the dropdown one by one as given here
...and then running this imported package from SQL Job. Still...nothing happened.
Does anyone know whats wrong?? How do I deal with following facts:
It has to do with permission of the sql user to make a web service request. How do I configure that out?
2.it has to do with the configuration file of imported ssis package. What should I look for?
Help me out please:
I hope I have given all the required info to look into the problem
is the job on an SQL Server Instance on your computer? I ask because it may be firewall or permission issues from the SQL Server to the computer you have the web service.
Also I advise removing that try catch and enabling package configurations so you can see if it is trowing an error
Regarding protection level, if you are using EncryptSensitiveWithUserKey the package wont load the database sensitive information (login and password) unless it is on the computer you developed it. Same thing applies to EncryptAllWithUserKey but in this case it wont even open the package
I have a report to which I have execute-only access - I don't have the access to the RDL file. This report exposes several parameters which I would like to set from URL.
I've successfully changed some parameters using the standard param=data form (as explained here: http://msdn.microsoft.com/en-us/library/ms153586.aspx). However, some parameters don't have the same parameter-prompt and parameter-name.
Unfortunately, to pass parameter values by URL I must know the name of the parameter and I don't see how I can deduct from the report and its parameters prompt text. I've tried to inspect the source and post-data but to no avail.
Anyone has an idea?
Thanks
P.S I also stumbled on this: http://odetocode.com/Articles/123.aspx. However, I wasn't able to connect to the web-services of my report server.
Ugh. I'm replying to myself, hopefully someone can learn from it:
I did it, eventually, using Reporting Services web service as described here and here. A point to remember here is that the name of the service has been changed (I believe from SQL server 2005 and onward) endpoint is ReportService2005.asmx.
After adding the web reference I was still having various problems. To summarize, this is the code that eventually worked for me (note: I am in domain and the IIS I'm connecting to requires domain windows auth).
ReportParameter[] parameters;
const string historyId = null;
const bool forRendering = true;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = new DataSourceCredentials[] {};
ReportingService2005SoapClient c = new ReportingService2005SoapClient();
c.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("USERNAME", "PASSWORD", "DOMAIN");
c.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;
c.GetReportParameters
(
"/CycleStatus/Builds Score",
historyId,
forRendering,
values,
credentials,
out parameters
);
However, I was plagued by the following error:
"The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'"
To handle that you need to change, in your app.config the security node, like so:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
After that everything worked fine.