| 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 | |
| Viewing file: Select action/file-type: 
 PerlThere are a few ways to use Perl to connect to a SQL Server using FreeTDS. DBD::SybaseThe 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::ODBCYou may also use DBD::ODBC with the FreeTDS ODBC driver. You may find this attractive if you're familiar with DBD::ODBC. SybperlFinally, 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 modulesExample 7-2. Building DBD::Sybase $ cd DBD-Sybase-0.91 $ export SYBASE=/usr/local/freetds $ perl Makefile.PL $ make $ su root Password: $ make install 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 
 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";
	}
	}
	connectstatement, welcome to the magic of DBI! | ||||||||
| :: Command execute :: | |
| --[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.9515 ]-- |