Showing posts with label perl. Show all posts
Showing posts with label perl. Show all posts

Sunday, March 25, 2012

ActiveX ActivePerl DTS Task

I need help with executing an ActiveX Perl DTS Task.

I have ActivePerl installed and I do not get a task error when I run it. The script works perfectly when I run it from a command prompt. The problem is that the task will not extract the files from the tar file.

sub Main()
{
#using modules
use Archive::Tar;
use Compress::Zlib;

#create a new tar archive object
my $tar = Archive::Tar->new;

#set the name of the compressed files
$main_tar = "C:\Inetpub\wwwroot\legacyrealestate\db\DW168E.tmp. tar";

#read the main tar file and extract files
$tar->read($main_tar,1);
$tar->extract();

return 0; # DTSTaskExecResult_Success;
}

Any clue?I think I know why it appears that it wasn't working. It worked but not like I expected. It extracted the files into the default sql server directory.

So My next question is how do specify the directory to extract to?

Originally posted by jcochran2003
I need help with executing an ActiveX Perl DTS Task.

I have ActivePerl installed and I do not get a task error when I run it. The script works perfectly when I run it from a command prompt. The problem is that the task will not extract the files from the tar file.

sub Main()
{
#using modules
use Archive::Tar;
use Compress::Zlib;

#create a new tar archive object
my $tar = Archive::Tar->new;

#set the name of the compressed files
$main_tar = "C:\Inetpub\wwwroot\legacyrealestate\db\DW168E.tmp. tar";

#read the main tar file and extract files
$tar->read($main_tar,1);
$tar->extract();

return 0; # DTSTaskExecResult_Success;
}

Any clue?|||This is really a perl question but I would try setting the directory by using the SetCwd(directory) command.|||Thanks I will try that.|||I keep getting a "Function not found" error. Can anybody give me a peice of sample code using Win32::SetCwd()?|||Here is the updated perl script.

#using modules
use Archive::Tar;
use Compress::Zlib;
use Win32::File;

sub Main()
{
#create a new tar archive object
my $tar = Archive::Tar->new;

#set the name of the compressed files
$main_tar = "C:\Inetpub\wwwroot\legacyrealestate\db\DW168E.tmp. tar";
$res_tar = "ListingsRESIDENTIAL-Residential.txt.gz";

# set the directory
$dir = "C:\Inetpub\wwwroot\legacyrealestate\db\";
Win32::SetCwd($dir);

#read the main tar file and extract files
$tar->read($main_tar,1);
$tar->extract();

return 0; # DTSTaskExecResult_Success;
}

Thursday, February 9, 2012

Accessing mySQL from .NET

Hello all,

We are planning to migrate an application written in Perl + mySQL to .NET + MS-SQL Server. The test machine now has SQL Server running. During the development phase in .NET, we would want to access the mySQL database which is being updated at real time, from the Windows box. This is how I think it has to be done:

1. Use DTS to migrate data from mySQL. Does DTS take care of migrating schema and the difference in data types between the mySQL and MS-SQL? Is there any 3rd party software out there that takes care of the migration without any manual labor?

2. Synchronize the data between 2 DBs by creating some kind of a batch job? If so, whats the best way of doing this?

Instead, is it easier to access the live mySQL database on the Linux box from the .NET code and move the DB only after development in the new environment is completed?

Any help/ideas is greatly appreciated.

TIAIn order to handle the schema, you use the transformation portion of dts(data transformation task). Do you need to have "live" information in the sql server database while you are creating the application in .Net ? If not, just take a snapshot of the data from mysql to sql server and perform the complete migration when you are ready to switch database servers.|||Ok, so if you have an ODBC driver for mySQL you should be able to use DTS to do SQL-92 compliant stuff with your old db.

In all honesty I would suggest that you move these two things one at a time, move either your database or your code but not both at the same time, your testing and debugging will be a nightmare otherwise.

Dan