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

Hi All
I have used the below method to connect my DB server. This is desktop application. Now the same script needs to be installed in another location. The perl script called in .Net windows application. Rightnow we have created webservices for .net but i don't know how to change these perl code to webservice methods. Can anyone guide me on this?

my $dbh = DBI->connect('DBI:ODBC:Driver={SQL Server};server={170.10.10 +.10};database={Copyediting};','username','password') or die "Can't connect to $data_source: $DBI::errstr"; my ($sql,$sth); $sql = "Select * from varianceDB where StyleName='".$Style_Name. +"' and PatternName='"."DEFAULT"."' and VarianceName='"."DEFAULT"."' a +nd Title='".$Pattern_Name."'"; $sth = $dbh->prepare($sql) or die "Can't prepare statement: $DBI:: +errstr"; # Execute the statement. $sth->execute(); my $ref = $sth->fetchall_arrayref({});

Replies are listed 'Best First'.
Re: Webservice Method
by davido (Cardinal) on May 05, 2014 at 08:03 UTC

    I'm interpreting your question to be asking how to use your database model with a web-based front-end. The question is broad enough that it's hard to answer specifically; we don't really know what your front end is supposed to do. But I can say that when I need to create an interaction between a database and a web user interface, I usually reach for Mojolicious::Lite, or Mojolicious if the project is larger in scale.

    I feel a little bad recommending a specific tool with a question so devoid of details that might influence the decision on what tools to use. But often enough, Mojolicious::Lite (or possibly a full Mojolicious app) can be one possible choice as a component in the solution for such things.


    Dave