Get an Alter XMLA string via C# script task
Hi,
I have an alter Database XMLA file that needs to be deployed to an Analysis Server only if there was a change with the existing database.
I have a C# script task that checks if the DB exists before deploying.
What I need to add, is code that compares the alter Database XMLA file with the existing DB metadata.
It would be good enough to get code example of how to extract the XMLA using AMO.
Hi ,
Please refer the below link for sample code
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5b17c421-699d-4dbf-849c-0531f4e0411e/extract-the-xml-form-dsv-and-cube-through-net
Best Regards Sorna
Similar Messages
-
Hi Experts,
I am trying to open .xlsx file in script task of SSIS 2005. I am using the 32-bit AccessDatabaseEngine driver with the Connection string as "Provider= Microsoft.ACE.OLEDB.12.0; Data Source=xlsx file path; Extended Properties="Excel 12.0 Xml;
HDR=YES"" in script task.
When we debug the VB script in Visual Studio 2005 and encounters the statement app.open() it throws the error "Couldn't find installable ISAM".
My SQL server version is 2005 SP2 DE
OS is Windows server 2003 EE SP2
Could anyone please let me know what is the resolution for this error?
Thanks and Regards,
AdeshHi Adesh,
First, make sure the package runs in 32-bit runtime mode (set Run64BitRuntime property to False) because you are using the 32-bit ACE OLE DB Provider. If it is not the case, the issue may occur due to the corrupted drivers or registry keys. You can try to
reinstall the 2007 Office System Driver: Data Connectivity Components as Arthur suggested.
Regards,
Mike Yin
TechNet Community Support -
Getting COM Component error while opening SSIS Script task.
Hi All,
While click on EDIT SCRIPT Button in script task it's not opening the script editing window.
Getting below error message:
"Error HRESULT E_FAIL has been returned from a call to a COM component. (EnvDTE)"
We have added ADODB reference in script task.
Thanks in advance, please give some suggestion.I am using SSIS 2008 R2.
When I reload the package, script task visual studio opens first time, next time when I try to open script task visual studio from EDIT SCRIPT Button it gives below error:
"Error HRESULT E_FAIL has been returned from a call to a COM component. (EnvDTE)" -
Pass variables to child via C# script task ?
I don't want to use package configurations to pass variables from Parent to child package. I'd prefer to pass the variables to child, from a C# script task in the parent package. Can this be done ? Here is the pseudocode for what I hope to do -
//code in script task of parent package
Main(){
Object parentObj = SSIS.ParentPackage.myObject;
String parentStr = SSIS.ParentPackage.myString;
callChildPackage(parentObj, parentStr);You have four choices for this:
Use Parent-Child variable configurations
Place the value in a variable in the parent package, which can be referenced from the child package, when run with an Execute Package Task. (http://agilebi.com/jwelch/2009/10/03/passing-an-object-from-a-parent-package-to-a-child)
Take over the execution of the child package entirely executing the package from inside your C# script task.
Use something like the Task Factory Advanced Execute Package task. (Full Disclosure: I work for Pragmatic Works)
Item 3 is probably closest to what you want. You'd need to use the Package.Execute method to run the child package yourself. The advantage of doing that is you can set child package variables explicitly before executing the package.
John Welch | www.pragmaticworks.com | www.agilebi.com | ssisUnit.codeplex.com -
Iterating inside a script task - SSIS 2012
Hi,
in order to create SSAS partitions I need to read a SQL Server table where I've year and month value.
So I think to iterate for each row inside the data set returned by the read operation and for each year and month value to create a SSAS partition.
Is it better to read the SQL Server table outside the script task? How can I iterate for each row in the dataset inside the script component?
Any suggests to me, please?
ThanksI've done similar requirement as below
1. Create a object type variable
2. Use Execute sql task to populate the recordset with partition information from the query. Use resultset option as Full resultset and map to object variable with index 0 in resultset tab
3. Use a For Each Loop with ADO enumerator and map to object variable. Then have variables inside to get individual field values
4. Add script task inside loop and pass the variables inside and use it to build your script task for partition processing. If you want you can also use analysis services DDL task for this too.
Also see these for more info
http://aniruddhathengadi.blogspot.in/2012/07/automate-creation-of-cube-partitions.html
http://dataqueen.unlimitedviz.com/2014/05/how-to-automate-ssas-cube-partitioning-in-ssis/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Getting app version string via the API, in AE 6.5 and 7.0
Hi-
I was wondering if there's a way to get the application version string
(such as "7.0x244") by using API functions.
This is doable with scripting, by calling app.version(), but I couldn't find an equivalent function in the API/SDK.There's no way to get the version as a string, though both the effect API and AEGP API provide versioning info.
-
How to alter 'add to file names' script?
I'm working on some stuff that I need to get done today, and it dawned on me that I could save a lot of time if I had a certain script perform a simple task for me. Unfortunately I haven't been able to get one to work right. I just want to be able to add the same thing onto the end of a file name... For instance, 01.jpg would become 01x.jpg, 02.jpg becomes 02x.jpg and so on. The basic 'Add to File Names' script will almost work, but it adds to the front of the name, not the back. Does anyone know how I could alter the lines in that script to get it to do what I want?
Thanks for any help,
Dave01. Under 'Alternative 01:', the line ...
No error checking for folders is included. Such is an exercise for the student.
... should have been ...
--No error checking for folders is included. Such is an exercise for the student.
02. The error message ...
"System Events got an Error: NSCannotCreateScriptCommandError".
Hmmm, those replying are using MacOS X 10.4.x, and you are using MacOS X 10.2.x. Others, with Macs running MacOS X 10.2.x and using AppleScript code from MacOS X 10.3.x and later, do at times experience 'NSCannotCreateScriptCommandError' error messages.
In the code below, 'System Events' was replaced with 'Finder'. Some additional editing was performed, where required.
Alternative 01:
property tAddition : "x" -- The charcter or string to append to the files' name.
tell application "Finder"
set tSelection to selection
--No error checking for folders is included. Such is an exercise for the student.
repeat with i in tSelection -- Cycle through the provided files.
set {displayed_name, name_Extension} to {displayed name of (i as alias), name extension of (i as alias)}
if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
-- Handle file names which include a name extension.
set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
else
set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
end if
end repeat
end tell
Save the AppleScript code as a script.
Move file (or a copy or alias of the file) to the '~/Library/Scripts/' folder.
Select files to be processed, in 'Finder'.
Select the script, via the 'Script menu'.
Alternative 02:
property tAddition : "x" -- The charcter or string to append to the files' name.
on run {} -- User double-click on the applet.
display dialog "Drag file(s) onto applet for processing."
end run
on open selected_Items -- User dragged items onto applet.
my handleitems(selectedItems) -- Processed items dragged onto applet.
end open
on handleitems(localItems)
-- No error checking for folders is included. Such is an exercise for the student.
tell application "Finder"
repeat with i in local_Items -- Cycle through the provided files.
set {displayed_name, name_Extension} to {displayed name of i, name extension of i}
if ((displayed_name ends with name_Extension) and ((count name_Extension) > 0)) then
-- Handle file names which include a name extension.
set (name of i) to ((get (characters 1 through ((count displayed_name) - (count name_Extension) - 1) of displayed_name) as string) & tAddition & "." & name_Extension)
else
set (name of i) to (displayed_name & tAddition) -- Handle file names without a name extension.
end if
end repeat
end tell
end handle_items
Save the AppleScript code as an applet (application).
Drag files to be processed, onto the applet, in 'Finder'. -
Webserver on DMZ cannot send email via php script using SMTP (cisco firewall pix 515e)
Hello,
I have two web servers that are sitting in a DMZ behind a Cisco Firewall PIX 515e. The webservers appear to be configured correctly as our website and FTP website are up. On two of our main website, we have two contact forms that use a simple html for to call a php script that uses smtp as its mailing protocol. Since, I am not the network administrator, I don't quite understand how to read the current configurations on the firewall, but I suspect that port 25 is blocked, which prevents the script from actually working or sending out emails. What I've done to narrow the problem done is the following: I used a wamp server to test our scripts with our smtp servers settings, was able to successfully send an email out to both my gmail and work place accounts. Currently, we have backupexec loaded on both of these servers, and when I try to send out an alert I never receive it. I think because port 25 is closed on both of those servers. I will be posting our configuration. if anyone can take a look and perhaps explain to me how I can change our webservers to communicate and successfully deliver mail via that script, I would gladly appreciate it. our IP range is 172.x.x.x, but it looks like our webservers are using 192.x.x.x with NAT in place. Please someone help.
Thanks,
Jeff Mateo
PIX Version 6.3(4)
interface ethernet0 100full
interface ethernet1 100full
interface ethernet2 100full
nameif ethernet0 outside security0
nameif ethernet1 inside security100
nameif ethernet2 DMZ security50
enable password GFO9OSBnaXE.n8af encrypted
passwd GFO9OSBnaXE.n8af encrypted
hostname morrow-pix-ct
domain-name morrowco.com
clock timezone EST -5
clock summer-time EDT recurring
fixup protocol dns maximum-length 512
fixup protocol ftp 21
fixup protocol h323 h225 1720
fixup protocol h323 ras 1718-1719
fixup protocol http 80
fixup protocol rsh 514
fixup protocol rtsp 554
fixup protocol sip 5060
fixup protocol sip udp 5060
fixup protocol skinny 2000
no fixup protocol smtp 25
fixup protocol sqlnet 1521
fixup protocol tftp 69
names
name 12.42.47.27 LI-PIX
name 172.20.0.0 CT-NET
name 172.23.0.0 LI-NET
name 172.22.0.0 TX-NET
name 172.25.0.0 NY-NET
name 192.168.10.0 CT-DMZ-NET
name 1.1.1.1 DHEC_339849.ATI__LEC_HCS722567SN
name 1.1.1.2 DHEC_339946.ATI__LEC_HCS722632SN
name 199.191.128.105 web-dns-1
name 12.127.16.69 web-dns-2
name 12.3.125.178 NY-PIX
name 64.208.123.130 TX-PIX
name 24.38.31.80 CT-PIX
object-group network morrow-net
network-object 12.42.47.24 255.255.255.248
network-object NY-PIX 255.255.255.255
network-object 64.208.123.128 255.255.255.224
network-object 24.38.31.64 255.255.255.224
network-object 24.38.35.192 255.255.255.248
object-group service morrow-mgmt tcp
port-object eq 3389
port-object eq telnet
port-object eq ssh
object-group network web-dns
network-object web-dns-1 255.255.255.255
network-object web-dns-2 255.255.255.255
access-list out1 permit icmp any any echo-reply
access-list out1 permit icmp object-group morrow-net any
access-list out1 permit tcp any host 12.193.192.132 eq ssh
access-list out1 permit tcp any host CT-PIX eq ssh
access-list out1 permit tcp any host 24.38.31.72 eq smtp
access-list out1 permit tcp any host 24.38.31.72 eq https
access-list out1 permit tcp any host 24.38.31.72 eq www
access-list out1 permit tcp any host 24.38.31.70 eq www
access-list out1 permit tcp any host 24.38.31.93 eq www
access-list out1 permit tcp any host 24.38.31.93 eq https
access-list out1 permit tcp any host 24.38.31.93 eq smtp
access-list out1 permit tcp any host 24.38.31.93 eq ftp
access-list out1 permit tcp any host 24.38.31.93 eq domain
access-list out1 permit tcp any host 24.38.31.94 eq www
access-list out1 permit tcp any host 24.38.31.94 eq https
access-list out1 permit tcp any host 24.38.31.71 eq www
access-list out1 permit tcp any host 24.38.31.71 eq 8080
access-list out1 permit tcp any host 24.38.31.71 eq 8081
access-list out1 permit tcp any host 24.38.31.71 eq 8090
access-list out1 permit tcp any host 24.38.31.69 eq ssh
access-list out1 permit tcp any host 24.38.31.94 eq ftp
access-list out1 permit tcp any host 24.38.31.92 eq 8080
access-list out1 permit tcp any host 24.38.31.92 eq www
access-list out1 permit tcp any host 24.38.31.92 eq 8081
access-list out1 permit tcp any host 24.38.31.92 eq 8090
access-list out1 permit tcp any host 24.38.31.93 eq 3389
access-list out1 permit tcp any host 24.38.31.92 eq https
access-list out1 permit tcp any host 24.38.31.70 eq https
access-list out1 permit tcp any host 24.38.31.74 eq www
access-list out1 permit tcp any host 24.38.31.74 eq https
access-list out1 permit tcp any host 24.38.31.74 eq smtp
access-list out1 permit tcp any host 24.38.31.75 eq https
access-list out1 permit tcp any host 24.38.31.75 eq www
access-list out1 permit tcp any host 24.38.31.75 eq smtp
access-list out1 permit tcp any host 24.38.31.70 eq smtp
access-list out1 permit tcp any host 24.38.31.94 eq smtp
access-list dmz1 permit icmp any any echo-reply
access-list dmz1 deny ip any 10.0.0.0 255.0.0.0
access-list dmz1 deny ip any 172.16.0.0 255.240.0.0
access-list dmz1 deny ip any 192.168.0.0 255.255.0.0
access-list dmz1 permit ip any any
access-list dmz1 deny ip any any
access-list nat0 permit ip CT-NET 255.255.0.0 192.168.220.0 255.255.255.0
access-list nat0 permit ip host 172.20.8.2 host 172.23.0.2
access-list nat0 permit ip CT-NET 255.255.0.0 LI-NET 255.255.0.0
access-list nat0 permit ip CT-NET 255.255.0.0 NY-NET 255.255.0.0
access-list nat0 permit ip CT-NET 255.255.0.0 TX-NET 255.255.0.0
access-list vpn-split-tun permit ip CT-NET 255.255.0.0 192.168.220.0 255.255.255
.0
access-list vpn-split-tun permit ip CT-DMZ-NET 255.255.255.0 192.168.220.0 255.2
55.255.0
access-list vpn-dyn-match permit ip any 192.168.220.0 255.255.255.0
access-list vpn-ct-li-gre permit gre host 172.20.8.2 host 172.23.0.2
access-list vpn-ct-ny permit ip CT-NET 255.255.0.0 NY-NET 255.255.0.0
access-list vpn-ct-ny permit ip CT-DMZ-NET 255.255.255.0 NY-NET 255.255.0.0
access-list vpn-ct-tx permit ip CT-NET 255.255.0.0 TX-NET 255.255.0.0
access-list vpn-ct-tx permit ip CT-DMZ-NET 255.255.255.0 TX-NET 255.255.0.0
access-list static-dmz-to-ct-2 permit ip host 192.168.10.141 CT-NET 255.255.248.
0
access-list nat0-dmz permit ip CT-DMZ-NET 255.255.255.0 192.168.220.0 255.255.25
5.0
access-list nat0-dmz permit ip CT-DMZ-NET 255.255.255.0 LI-NET 255.255.0.0
access-list nat0-dmz permit ip CT-DMZ-NET 255.255.255.0 NY-NET 255.255.0.0
access-list nat0-dmz permit ip CT-DMZ-NET 255.255.255.0 TX-NET 255.255.0.0
access-list static-dmz-to-ct-1 permit ip host 192.168.10.140 CT-NET 255.255.248.
0
access-list static-dmz-to-li-1 permit ip CT-DMZ-NET 255.255.255.0 CT-NET 255.255
.248.0
access-list vpn-ct-li permit ip CT-NET 255.255.0.0 LI-NET 255.255.0.0
access-list vpn-ct-li permit ip CT-DMZ-NET 255.255.255.0 LI-NET 255.255.0.0
access-list vpn-ct-li permit ip host 10.10.2.2 host 10.10.1.1
access-list in1 permit tcp host 172.20.1.21 any eq smtp
access-list in1 permit tcp host 172.20.1.20 any eq smtp
access-list in1 deny tcp any any eq smtp
access-list in1 permit ip any any
access-list in1 permit tcp any any eq smtp
access-list cap4 permit ip host 172.20.1.82 host 192.168.220.201
access-list cap2 permit ip host 172.20.1.82 192.168.220.0 255.255.255.0
access-list in2 deny ip host 172.20.1.82 any
access-list in2 deny ip host 172.20.1.83 any
access-list in2 permit ip any any
pager lines 43
logging on
logging timestamp
logging buffered notifications
logging trap notifications
logging device-id hostname
logging host inside 172.20.1.22
mtu outside 1500
mtu inside 1500
mtu DMZ 1500
ip address outside CT-PIX 255.255.255.224
ip address inside 172.20.8.1 255.255.255.0
ip address DMZ 192.168.10.1 255.255.255.0
ip audit info action alarm
ip audit attack action alarm
ip local pool ctpool 192.168.220.100-192.168.220.200
ip local pool ct-thomson-pool-201 192.168.220.201 mask 255.255.255.255
pdm history enable
arp timeout 14400
global (outside) 1 24.38.31.81
nat (inside) 0 access-list nat0
nat (inside) 1 CT-NET 255.255.0.0 2000 10
nat (DMZ) 0 access-list nat0-dmz
static (inside,DMZ) CT-NET CT-NET netmask 255.255.0.0 0 0
static (inside,outside) 24.38.31.69 172.20.8.2 netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.94 192.168.10.141 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.71 172.20.1.11 dns netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.93 192.168.10.140 netmask 255.255.255.255 0 0
static (DMZ,inside) 24.38.31.93 access-list static-dmz-to-ct-1 0 0
static (DMZ,inside) 24.38.31.94 access-list static-dmz-to-ct-2 0 0
static (inside,outside) 24.38.31.92 172.20.1.56 netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.91 192.168.10.138 netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.90 192.168.10.139 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.72 172.20.1.20 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.73 172.20.1.21 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.70 172.20.1.91 netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.88 192.168.10.136 netmask 255.255.255.255 0 0
static (DMZ,outside) 24.38.31.89 192.168.10.137 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.74 172.20.1.18 netmask 255.255.255.255 0 0
static (inside,outside) 24.38.31.75 172.20.1.92 netmask 255.255.255.255 0 0
access-group out1 in interface outside
access-group dmz1 in interface DMZ
route outside 0.0.0.0 0.0.0.0 24.38.31.65 1
route inside 10.10.2.2 255.255.255.255 172.20.8.2 1
route inside CT-NET 255.255.248.0 172.20.8.2 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 rpc 0:10:00 h225 1:00:00
timeout h323 0:05:00 mgcp 0:05:00 sip 0:30:00 sip_media 0:02:00
timeout uauth 0:05:00 absolute
aaa-server TACACS+ protocol tacacs+
aaa-server TACACS+ max-failed-attempts 3
aaa-server TACACS+ deadtime 10
aaa-server RADIUS protocol radius
aaa-server RADIUS max-failed-attempts 3
aaa-server RADIUS deadtime 10
aaa-server LOCAL protocol local
aaa-server ct-rad protocol radius
aaa-server ct-rad max-failed-attempts 2
aaa-server ct-rad deadtime 10
aaa-server ct-rad (inside) host 172.20.1.22 morrow123 timeout 7
aaa authentication ssh console LOCAL
aaa authentication http console LOCAL
aaa authentication serial console LOCAL
aaa authentication telnet console LOCAL
http server enable
http 173.220.252.56 255.255.255.248 outside
http 65.51.181.80 255.255.255.248 outside
http 208.65.108.176 255.255.255.240 outside
http CT-NET 255.255.0.0 inside
no snmp-server location
no snmp-server contact
snmp-server community m0rroW(0
no snmp-server enable traps
floodguard enable
sysopt connection permit-ipsec
sysopt connection permit-pptp
crypto ipsec transform-set 3des-sha esp-3des esp-sha-hmac
crypto ipsec transform-set 3des-md5 esp-3des esp-md5-hmac
crypto dynamic-map dyn_map 20 match address vpn-dyn-match
crypto dynamic-map dyn_map 20 set transform-set 3des-sha
crypto map ct-crypto 10 ipsec-isakmp
crypto map ct-crypto 10 match address vpn-ct-li-gre
crypto map ct-crypto 10 set peer LI-PIX
crypto map ct-crypto 10 set transform-set 3des-sha
crypto map ct-crypto 15 ipsec-isakmp
crypto map ct-crypto 15 match address vpn-ct-li
crypto map ct-crypto 15 set peer LI-PIX
crypto map ct-crypto 15 set transform-set 3des-sha
crypto map ct-crypto 20 ipsec-isakmp
crypto map ct-crypto 20 match address vpn-ct-ny
crypto map ct-crypto 20 set peer NY-PIX
crypto map ct-crypto 20 set transform-set 3des-sha
crypto map ct-crypto 30 ipsec-isakmp
crypto map ct-crypto 30 match address vpn-ct-tx
crypto map ct-crypto 30 set peer TX-PIX
crypto map ct-crypto 30 set transform-set 3des-sha
crypto map ct-crypto 65535 ipsec-isakmp dynamic dyn_map
crypto map ct-crypto client authentication ct-rad
crypto map ct-crypto interface outside
isakmp enable outside
isakmp key ******** address LI-PIX netmask 255.255.255.255 no-xauth no-config-mo
de
isakmp key ******** address 216.138.83.138 netmask 255.255.255.255 no-xauth no-c
onfig-mode
isakmp key ******** address NY-PIX netmask 255.255.255.255 no-xauth no-config-mo
de
isakmp key ******** address TX-PIX netmask 255.255.255.255 no-xauth no-config-mo
de
isakmp identity address
isakmp nat-traversal 20
isakmp policy 10 authentication pre-share
isakmp policy 10 encryption 3des
isakmp policy 10 hash sha
isakmp policy 10 group 2
isakmp policy 10 lifetime 86400
isakmp policy 20 authentication pre-share
isakmp policy 20 encryption 3des
isakmp policy 20 hash md5
isakmp policy 20 group 2
isakmp policy 20 lifetime 86400
isakmp policy 30 authentication pre-share
isakmp policy 30 encryption 3des
isakmp policy 30 hash md5
isakmp policy 30 group 1
isakmp policy 30 lifetime 86400
vpngroup remotectusers address-pool ctpool
vpngroup remotectusers dns-server 172.20.1.5
vpngroup remotectusers wins-server 172.20.1.5
vpngroup remotectusers default-domain morrowny.comAmit,
I applaud your creativity in seeking to solve your problem, however, this sounds like a real mess in the making. There are two things I don't like about your approach. One, cron -> calling Java -> calling PHP -> accessing database, it's just too many layers, in my opinion, where things can go wrong. Two it seems to me that you are exposing data one your website (with the PHP) that you may not want expose and this is an important consideration when you are dealing with emails and privacy and so on.
I think the path of least resistance would be to get a new user account added to the MySQL database that you can access remotely with your Java program. This account can be locked down for read only access and be locked down to the specific IP or IP range that your Java program will be connecting from.
Again I applaud your creativity but truly this seems like a hack because of the complexity and security concerns you are introducing and I think is a path to the land of trouble. Hopefully you will be able to get a remote account set up. -
SSIS 2012 Script Task to Get File Properties
Hello,
I researched on how to grab a file properties such as file size, file modified date, etc and I came across the following
link:
I followed exact steps and when I went to execute the package, I got the following error:
Below is the code:
// C# code
// Fill SSIS variables with file properties
using System;
using System.Data;
using System.IO; // Added to get file properties
using System.Security.Principal; // Added to get file owner
using System.Security.AccessControl; // Added to get file owner
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_cb8dd466d98149fcb2e3852ead6b6a09.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
public void Main()
// Lock SSIS variables
Dts.VariableDispenser.LockForRead("User::FilePath");
Dts.VariableDispenser.LockForWrite("User::FileAttributes");
Dts.VariableDispenser.LockForWrite("User::FileCreationDate");
Dts.VariableDispenser.LockForWrite("User::FileExists");
Dts.VariableDispenser.LockForWrite("User::FileInUse");
Dts.VariableDispenser.LockForWrite("User::FileIsReadOnly");
Dts.VariableDispenser.LockForWrite("User::FileLastAccessedDate");
Dts.VariableDispenser.LockForWrite("User::FileLastModifiedDate");
Dts.VariableDispenser.LockForWrite("User::FileOwner");
Dts.VariableDispenser.LockForWrite("User::FileSize");
// Create a variables 'container' to store variables
Variables vars = null;
// Add variables from the VariableDispenser to the variables 'container'
Dts.VariableDispenser.GetVariables(ref vars);
// Variable for file information
FileInfo fileInfo;
// Fill fileInfo variable with file information
fileInfo = new FileInfo(vars["User::FilePath"].Value.ToString());
// Check if file exists
vars["User::FileExists"].Value = fileInfo.Exists;
// Get the rest of the file properties if the file exists
if (fileInfo.Exists)
// Get file creation date
vars["User::FileCreationDate"].Value = fileInfo.CreationTime;
// Get last modified date
vars["User::FileLastModifiedDate"].Value = fileInfo.LastWriteTime;
// Get last accessed date
vars["User::FileLastAccessedDate"].Value = fileInfo.LastAccessTime;
// Get size of the file in bytes
vars["User::FileSize"].Value = fileInfo.Length;
// Get file attributes
vars["User::FileAttributes"].Value = fileInfo.Attributes.ToString();
vars["User::FileIsReadOnly"].Value = fileInfo.IsReadOnly;
// Check if the file isn't locked by an other process
try
// Try to open the file. If it succeeds, set variable to false and close stream
FileStream fs = new FileStream(vars["User::FilePath"].Value.ToString(), FileMode.Open);
vars["User::FileInUse"].Value = false;
fs.Close();
catch (Exception ex)
// If opening fails, it's probably locked by an other process
vars["User::FileInUse"].Value = true;
// Log actual error to SSIS to be sure
Dts.Events.FireWarning(0, "Get File Properties", ex.Message, string.Empty, 0);
// Get the Windows domain user name of the file owner
FileSecurity fileSecurity = fileInfo.GetAccessControl();
IdentityReference identityReference = fileSecurity.GetOwner(typeof(NTAccount));
vars["User::FileOwner"].Value = identityReference.Value;
// Release the locks
vars.Unlock();
Dts.TaskResult = (int)ScriptResults.Success;
Eventually I am looking to just grab the Modified Date from the Windows Explorer folder and insert into table. Any suggestions? Thank you in advance!
Sanjeev
Sanjeev JhaHi SSISJoost,
I am so glad you responded to this thread. You are absolutely right. I copied the entire code including the project name (guid) and that solved the error problem.
Now, what did you do to get the message box? I added the watch and I could see the values but how do I get these values in a table? If I remember correctly, in your blog, you mentioned something about using derived columns. I am familiar with Derived Columns
but how do I do that? I appreciate your response.
Thank you.
Sanjeev
Sanjeev Jha
I used a second script task to show all variable values. It has a
MessageBox in it and between all
variables I added a
newline to make it more readable...
But with an Execute SQL Task and parameters you can also put these values in a Table... or you can read the file in a Data Flow Task and add those variables (as metadata) to each record with a Derived Column
Please mark the post as answered if it answers your question | My SSIS Blog:
http://microsoft-ssis.blogspot.com |
Twitter -
Getting windows error during running the sql scripts from form 6i
I made a little form application. The purpose of this application is to generate explain plan for a particular SQL. Some sql scripts run internally in order to populate the result on forms screen after pressing the forms button but I am getting windows error during running the sql scripts from form 6i.
I am using forms 6i with patch 17 with Oracle 10G database on windows 2000 professional on same computer.
This application runs fine with 8i.
Please inform me where the problem is and how to overcome it.
Zafri.I am using Text_IO in my form's when button press trigger , inorder to create the
text file, then in the same when button press triger
I am calling RMAN via host command in order to run the script which was created by text_IO.
Below you find some of the code. I will appreciate if you solve the problem.
when button press trigger:
Declare
in_file3 Text_IO.File_Type;
linebuf3 VARCHAR2(1800);
output11 varchar2(1000);
BEGIN
output11:='C:\EXPLAIN_PLUS\misc\rm_file.bat ';
Host(output11,no_screen);
:sql.execution_plan:= 'Working........................';
synchronize;
in_file3 := Text_IO.Fopen('c:\explain_plus\misc\create_table.txt', 'w');
Text_IO.Put_Line(in_file3, linebuf3);
Text_IO.put_line(in_file3,' ');
Text_IO.put_line(in_file3,' run { sql "create table PLAN_TABLE (statement_id,...object_name varchar2(30),object_instance numeric,object_type varchar2(30),optimizer varchar2(255),search_columns number,id .....partition_start varchar2(255),partition_stop varchar2(255),partition_id numeric,other long,distribution varchar2(30)) "; } ');
Text_IO.put_line(in_file3,' ');
Text_IO.put_line(in_file3,' ');
Text_IO.FCLOSE(in_file3)
Declare
un VARCHAR2(80);
pw VARCHAR2(80);
cn VARCHAR2(80);
output VARCHAR2(1000);
output2 VARCHAR2(1000);
dummy varchar2(40);
in_file Text_IO.File_Type;
linebuf VARCHAR2(1800);
BEGIN
Get_Connect_Info(un,pw,cn);
/* for Plan_table Begg. Second INNER BLOCK */
declare
dummy2 varchar2(40);
begin
select table_name into dummy2 from all_tables where table_name='PLAN_TABLE';
if dummy2 = 'PLAN_TABLE' then
output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\MISC\TRUNC2.txt ' ;
Host(output2,no_screen);
end if;
exception
when no_data_found then
output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\misc\create_table.txt ';
Host(output2,no_screen);
end; -- -
When I "save page as" via the file button at the top edge of the page, I also get a folder containing gif images, jscript script files and other similar items. I am not is allowed to delete it unless I also delete the page I need. How can I stop this from happening. is it the way I've configured firefox perhaps.
== since I installed firefoxMake sure that you have selected "Web Page, complete" to save the page.
-
Create Oracle OCI JDBCConnectionPool via silent script
Hi there,
I'm currently trying to create a JDBCConnectionPool via silent script that uses the Oracle OCI thick driver. My silent script looks like this:
create JDBCConnectionPool "MyPool" as jdbcpool;
set jdbcpool.DbmsHost "myhost";
set jdbcpool.DbmsPort "1521";
set jdbcpool.Password "user";
set jdbcpool.URL "jdbc:oracle:oci:@//myhost:1521/mysid";
set jdbcpool.DriverName "oracle.jdbc.pool.OracleDataSource";
set jdbcpool.Properties "user=user;portNumber=1521;SID=mysid;serverName=myhost;dll=ocijdbc9;protocol=oci";
The log of the silent script says everything was set successfully. Unfortunately when I take a look at the "Connection Pools" at the GUI admin console, the URL for the jdbcpool has been changed to "jdbc:bea:oracle:///myhost:1521" !
I'm using WebLogic 8.1SP3 with Oracle 9.2.0.5!
Can anyone help me with this? Any hint/help is appreciated!
- razeHi Joe,
I've done a demo script that produces the described "error". Would be great if you (or anybody else) could check if the same behaviour occurs.
[... start script ...]
read template from "/opt/bea/8.1.SP3/user_home/common/templates/domains/wls.jar";
create Cluster "MyCluster" as c1;
set c1.ClusterAddress "127.0.0.1:59251";
set c1.MulticastAddress "237.0.0.1";
set c1.MulticastPort "59251";
find Server "myserver" as s1;
set s1.Name "AdminServer";
set s1.ListenAddress "";
set s1.ListenPort "59261";
set s1.HostnameVerificationIgnored "true";
set s1.SSL.Enabled "true";
set s1.SSL.ListenPort "59262";
create Server "ManagedServer" as n1;
set n1.ListenAddress "";
set n1.ListenPort "59251";
set n1.Cluster "MyCluster";
set n1.HostnameVerificationIgnored "true";
set n1.Machine "MyMachine";
set n1.SSL.Enabled "false";
create UnixMachine "MyMachine" as machine1;
set machine1.NodeManager.ListenPort "59255";
set machine1.NodeManager.Name "MyMachine";
create JDBCConnectionPool "MyPool" as jdbcpool;
set jdbcpool.DbmsName "user";
set jdbcpool.Password "user";
set jdbcpool.Properties "user=user;portNumber=1521;SID=db-sid;serverName=db-host;dll=ocijdbc9;protocol=oci";
set jdbcpool.URL "jdbc:oracle:oci:@//db-host:1521/db-sid";
set jdbcpool.DriverName "oracle.jdbc.pool.OracleDataSource";
assign JDBCConnectionPool "*" to target "MyCluster";
find User "weblogic" as u1;
set u1.password "weblogic";
set OverwriteDomain "true";
write domain to "/home/user/BeaDomain";
close template;
[... end script ...]
Setting the URL succeeds as the log says:
[runScript] com.bea.plateng.domain.script.ScriptExecutor - set jdbcpool attribute URL to "jdbc:oracle:oci:@//db-host:1521/db-sid"
[runScript] com.bea.plateng.domain.script.ScriptExecutor - succeed: set jdbcpool attribute URL to "jdbc:oracle:oci:@//db-host:1521/db-sid"
But nevertheless the "config.xml" of the created domain contains the following entry:
<JDBCConnectionPool Name="MyPool" Targets="MyCluster"
DriverName="oracle.jdbc.pool.OracleDataSource"
Password="{3DES}Zlf46kqr6QE=" Properties="" URL="jdbc:bea:oracle:///db-host:1521"/>
Thus I assume when writing the domain, the URL gets changed for some reason. I also tried to increase the log level by executing the script with the options "-log_priority=debug -silent_priority=debug", but that did not help to find out why the URL got changed.
Is there maybe someone already using the Oracle OCI thick driver successfully and could post/email me the used silent script?
Greetings,
raze -
Passing long string to shell script from java
I am trying to passa a long string to a shell process through java,
call is like
Runtime rtime = Runtime.getRuntime();
String callAndArgs[] = {"/apps/jetty4/jstest/jstest.sh",jarCo,queue,text};
Process child = rtime.exec(callAndArgs);
here the string text is :
|HEADER|JAR933|[email protected]|290001|OL0006528|WIN4015444|SHAFT_FORGING|1.0|Baan EDM|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|290001|WIN4015444|00||||2|SHAFT FORGING|9|AXELSMIDE|3|ACHSE SCHMIEDEST�CK|4|ARBRE FORG�|f|AKSELITAOS|||||||||||||||||||||||No||Approved|41.0|Mechanic|Yes|pc||WIN4015444|EL20|Purchased|Metric||0|20051120|||||Released||||||||||||||||No||||||||||||||||||||||||||||||||
Now i use this string in shell script to pass as an argument to other class. But the string gets truncated.
How do i solve this?It appears that your os is truncating the data - Java's not involved.
Maybe write the data to a file and then read it into the external program some way. -
Activate a session via Gui scripting
Hi,
how to activate an active SAP-session via Gui Scripting or maybe a workaround?
There are some SAP sessions running and I want to activate a certain one of them.
I tried to activate a session with:
AppActivate session.findById("wnd[0]").Text
but, as we know, if there are the same task names in Task Manager, the function will start any one of them.
Any idea?
Edited by: Stefan Benkö on Feb 9, 2009 7:07 AMDear Casmir,
I use the following code:
suFound = False
suError = False
sgSystem = Trim(Cells(Target.Row, scSysCol))
sgClient = Trim(Cells(Target.Row, scCliCol))
sgUser = Trim(Cells(Target.Row, scUsrCol))
sgPW = Trim(Cells(Target.Row, scPwdCol))
suError = True
suError = Not ssApplication
If suError Then GoTo StopSub
For Each suConnection In sgApplication.Connections
suSysName = suConnection.Description
If suSysName = sgSystem Then
For Each suSession In suConnection.sessions
suSysClient = suSession.info.client
If suSysClient = sgClient Then
AppActivate suSession.findById("wnd[0]").Text
'Aktive Instanz herausfinden, SID/Client checken
Set suAkt = sgApplication.ActiveSession()
suAktName = suAkt.Parent.Description
suAktClient = suAkt.info.client
If sgSystem <> suAktName Or sgClient <> suAktClient Then
If Not suFound Then
suFound = True
AppActivate "Microsoft Excel"
A = MsgBox(sgSystem & " - " & sgClient & " NOT selectable", vbOKOnly + vbCritical + vbDefaultButton1, "SAP Automation")
End If
Else
suFound = True
End If
Exit For
End If
suSysClient = ""
Next
End If
If suFound Then Exit For
suSysName = ""
Next
As you can see, I got at that point all the necessary session and connection data.
There are several SAP-Tasks open and what I want is to get a specific one as active window on my screen. That doesn't work if the sessions have the same Task-name, for instance "SAP Easy Access". Because Windos is not albe to find the right SAP-task - they have the same name - and it takes usally the wrong one of them. Thats my problem.
Many Thanks for your Help -
Hi Oracle Experts,
I have a challenging question . Lets say I have two table with same name, but these two tables comes from two different databases with 2 different users.
Source Database A and User SCOTT
Table
Column
Data_Type
Length
Precision
Scale
Primary Key
Nullable
Default
Comment
BOOKS
BOOK_ID
Varchar2
4
1
ISBN_10
Varchar2
13
yes
PRICE
Number
6
2
yes
Target Database B and User DAVID
Table
Column
Data_Type
Length
Precision
Scale
Primary Key
Nullable
Default
Comment
BOOKS
BOOK_ID
Varchar2
20
1
PRICE
Number
6
2
yes
TITLE
Varchar2
50
yes
What I want to do:
I want to get a query script that shows which columns need to modify, add and drop depends on source table (Make any necessary changes to make Target table columns same as Source table columns) . No need to do any changes in the database only want to see the query that needs to run for making these changes.
EXAMPLE: I was using below query to get EMP table creation query. But seeing column information to create same column for other user is hard:(
select dbms_metadata.get_ddl ('TABLE', 'EMP') from dualTools > Database DIFF
Use the object selector to only compare BOOKS
You'll get an ALTER Script as part of the results.
Maybe you are looking for
-
With the rapid oncoming inevitability of Windows 7 and having completely skipped Vista as a viable Enterprise OS I've been doing a bit of testing. I have had Windows 7 x64 Build 7232 running as my primary OS for a bit over a week now and I have to sa
-
Is it possible to display the spanish app store in English instead of Spanish?
I want the content displayed in the Spanish app store displayed in English if possible. Can this be done?
-
My Computer won't let me download iTunes 7.6
Can anyone help me? I try downloading iTunes 7.6 but when I do, a message comes up that says Service 'iPod Service' (iPod Service) could not be installed. Verify that you have sufficient privileges to install system services. That's exactly what it s
-
Does anyone know if there is a way to DESELECT the "Automatically update the date and time when the document is opened" dialog? Thanks. Paul
-
Photoshop CS6 Randomly Crashes using Intel HD Graphics 4000
When using Photoshop CS6 on Windows 8 [Surface Pro], it randomly crashes. I normally can only use Photoshop for less than a minute, doing less than ten actions, before it crashes. I get an error message saying "Adobe Photoshop CS6 has stopped working