!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/lampp/share/doc/freetds-0.91/userguide/   drwxr-xr-x
Free 13.9 GB of 61.93 GB (22.44%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     perl.htm (7.36 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Perl

Perl

There are a few ways to use Perl to connect to a SQL Server using FreeTDS.

DBD::Sybase

The recommended choice is DBD::Sybase from Michael Peppler. Despite the name it works for any Sybase or Microsoft SQL Server. DBD::Sybase uses the CT-Library API and works well.

DBD::ODBC

You may also use DBD::ODBC with the FreeTDS ODBC driver. You may find this attractive if you're familiar with DBD::ODBC.

Sybperl

Finally, you can use Sybperl. Scripts written against Sybperl will not run against other databases the way DBI scripts will. However, it will be familiar ground for those who know DB-Library.

Building and using the Perl modules

Example 7-2. Building DBD::Sybase

	$ cd DBD-Sybase-0.91
	$ export SYBASE=/usr/local/freetds
	$ perl Makefile.PL
	$ make
	$ su root
	Password: 
	$ make install
There will be some output about missing libraries after perl Makefile.PL. These are normal.

The following example will attach to Sybase's public JDBC server and run a simple query (it can be found in samples/test.pl):

Example 7-3. Connect to a server with DBD::Sybase

	#!/usr/local/bin/perl
	#
	use DBI;
	
	my $dbh = DBI->connect("dbi:Sybase:server=JDBC", 'guest', 'sybase', {PrintError => 0});
	
	die "Unable for connect to server $DBI::errstr"
	unless $dbh;
	
	my $rc;
	my $sth;
	
	$sth = $dbh->prepare("select \@\@servername");
	if($sth->execute) {
	while(@dat = $sth->fetchrow) {
	print "@dat\n";
	}
	}
	

Example 7-4. Building DBD::ODBC

	$ cd DBD-ODBC-0.28
	$ export SYBASE=/usr/local/freetds
	$ export ODBCHOME=/usr/local
	$ export DBI_DSN=dbi:ODBC:JDBC
	$ export DBI_USER=guest
	$ export DBI_PASS=sybase
	$ perl Makefile.PL
	$ make
	$ su root
	Password: 
	$ make install

Note

We used the public JDBC server logins for our configuration here. You'll want to replace these with ones suitable to your environment.

Example 7-5. Connect to a server with DBD::ODBC

	#!/usr/local/bin/perl
	#
	use DBI;
	
	my $dbh = DBI->connect("dbi:ODBC:JDBC", 'guest', 'sybase', {PrintError => 0});
	
	die "Unable for connect to server $DBI::errstr"
	unless $dbh;
	
	my $rc;
	my $sth;
	
	$sth = $dbh->prepare("select \@\@servername");
	if($sth->execute) {
	while(@dat = $sth->fetchrow) {
	print "@dat\n";
	}
	}
	
You'll note this is the same program as for DBD::Sybase with the exception of the connect statement, welcome to the magic of DBI!


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.9515 ]--