Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Sybase to MSSQl migration for Perl in Linux RHEL

by prakruthias (Initiate)
on Jan 17, 2021 at 12:59 UTC ( [id://11127037]=perlquestion: print w/replies, xml ) Need Help??

prakruthias has asked for the wisdom of the Perl Monks concerning the following question:

We have a requirement for the migration project from Sybase to mssql in Linux box which is RHEL

We have bunch of Perl programs which is connecting to Sybase and has to be migrated to MSSQL in the Linux box RHEL.

I see two option

1. Microsoft ODBC driver and DBD:ODBC cpan module along with unixODBC

DBI -> unixODBC -> DBD:ODBC & microsoft's ODBC DRIVER.

2. Using freetds and sybase's DBD::Sybase

My question is which option is more feasible considering my environment

  1. Linux RHEL
  2. Perl code connecting to Sybase has to be migrated to MSSQL Perl code.
  3. One mssql.pm ( just a name given by me, ) module has to connect with around 400 Perl script with minimal code changes in 400 scripts.

***Is anyone here already done this and get successful

Please kindly help .

My research : I hardly seen people connecting to MSSQl using ODBC driver provided by MySQL ( guess it has been introduced recently)

But I was able to set it up using below link

https://github.com/pplu/perl-mssql-server/blob/master/connect.pl

And I see a comment in internet saying::
"Microsoft has a driver for Linux which can be used to connect via Linux. I had tried it and it worked like a charm. I was able to connect to SQL server using Microsoft binary. The real problem is that it cannot be used as Perl module to extend the usability via scripting"

https://www.slideshare.net/mobile/venkivoice/connect-sqlusingperlfromlinux

Im really confused which one to take and which one is feasible for our requirement.

2021-01-24 Athanasius added tags.

  • Comment on Sybase to MSSQl migration for Perl in Linux RHEL

Replies are listed 'Best First'.
Re: Sybase to MSSQl migration for Perl in Linux RHEL
by talexb (Chancellor) on Jan 18, 2021 at 02:51 UTC

    I used FreeTDS to connect to an MSSQL database. The documentation is available here.

    The configuration file I use (slightly sanitized for obvious reasons) is here:

    # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ # # This file is installed by FreeTDS if no file by the same # name is found in the installation directory. # # For information about the layout of this file and its settings, # see the freetds.conf manpage "man freetds.conf". # Global settings are overridden by those in a database # server specific section [global] # TDS protocol version ; tds version = 4.2 # Whether to write a TDSDUMP file for diagnostic purposes # (setting this to /tmp is insecure on a multi-user system) dump file = /tmp/freetds.log debug flags = 0xffff # Command and connection timeouts ; timeout = 10 ; connect timeout = 10 # If you get out-of-memory errors, it may mean that your clien +t # is trying to allocate a huge buffer for a TEXT field. # Try setting 'text size' to a more reasonable limit text size = 64512 # A typical Microsoft server [SqlServer] database = ABCDAT host = 192.0.0.1 port = 1433 tds version = 7.4 client charset = UTF-8 dump file = /tmp/foo.log debug flags = 0x001e

    There is a Microsoft driver, but this one worked for me (although it doesn't allow multiple active statement handles). I set this up about three years ago, so I may not be able to explain how I got it working.

    If I had time, I'd love to try the Microsoft driver .. but for now, this works.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: Sybase to MSSQl migration for Perl in Linux RHEL
by Tux (Canon) on Jan 18, 2021 at 09:05 UTC
Re: Sybase to MSSQl migration for Perl in Linux RHEL
by LanX (Saint) on Jan 17, 2021 at 21:54 UTC
Re: Sybase to MSSQl migration for Perl in Linux RHEL
by betmatt (Scribe) on Jan 17, 2021 at 21:00 UTC
    I don't believe that your post is well written. It is however hard to tell because you have not marked out the question properly, using the HTML markup language tags. I suggest that you use the break command via HTML. Then look to whether you can further improve the layout. While doing that you might find that the answer to your question either comes to you or you find that the logic calls you to make your own enquiries. Just a thought.
Re: Sybase to MSSQl migration for Perl in Linux RHEL
by Anonymous Monk on Jan 18, 2021 at 16:07 UTC
    You need to tell us a lot more about how these 400 scripts were built right now. Did they use ODBC to connect? If so, you might be able to do a lot by changing the ODBC data-source definition itself, which is (by design) centrally managed. Changing the SQL and/or programming within the scripts is more problematic since the two database engines are not quite the same. What we – and you – need right now are details. For instance, can you post the source-code of one small but complete script for our inspection? Before you and your colleagues start to "actually change anything anywhere," you need to plan this project and its deployment quite thoroughly.

      Right -- and I didn't tell you everything about how I set this client up. I used a module for credentials and the DSN information like this:

      package ABCDB; our $DSN = 'Driver=FreeTDS;ServerName=SqlServer;Database=ABCDAT'; our $User = 'User'; our $Password = 'Password'; our $Attributes = { LongReadLen => 65535, LongTruncOk => 1, odbc_query_timeout => 30 } +;
      Then, in each of the scripts I wrote, a connection just uses the boilerplate
      my $dbh = DBI->connect ( "dbi:ODBC:$ABCDB::DSN", $ABCDB::User, $ABCDB::Password, $ABCDB::Attributes );
      And a final note .. this module is in a separate directory specifically so that it's *not* included in the repository. Never include any authentication in a repository, even if it's a private one.

      Alex / talexb / Toronto

      Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11127037]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found