develop:perl:mssql
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판
이전 판
다음 판
|
이전 판
|
develop:perl:mssql [2011/11/14 10:19] starlits [Example] |
develop:perl:mssql [2011/11/14 10:55] (현재) starlits [Perl을 이용하여 MS SQL Server 활용하기] |
====== Debian Linux에서 MS SQL Server 접근하기 ====== | ====== Perl을 이용하여 MS SQL Server 연동하기 ====== |
| |
===== Installation ===== | ===== Installation ===== |
$dsn = 'DBI:Sybase:server=admindb'; | $dsn = 'DBI:Sybase:server=admindb'; |
| |
my $dbh = DBI->connect($dsn, "mssql_username", 'mssql_password'); | my $dbh = DBI->connect($dsn, "mssql_username", "mssql_password"); |
die "unable to connect to server $DBI::errstr" unless $dbh; | die "unable to connect to server $DBI::errstr" unless $dbh; |
| |
$dbh->do("use mssql_database"); | $dbh->do("use mssql_database"); |
$sth = $dbh->prepare ($query) or die "prepare failed\n"; | $sth = $dbh->prepare ($query) or die "prepare failed\n"; |
$sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; | $sth->execute( ) or die "unable to execute query $query error $DBI::errstr"; |
| |
$rows = $sth->rows ; | |
print "$row rows returned by query\n"; | |
| |
while ( @first = $sth->fetchrow_array ) { | while ( @first = $sth->fetchrow_array ) { |
} | } |
} | } |
| |
| $dbh->disconnect; |
</code> | </code> |
- [[develop:perl:oracle| DBI를 이용하여 Oracle 연동하기]] 도 참조해 보자. | - [[develop:perl:oracle| DBI를 이용하여 Oracle 연동하기]] 도 참조해 보자. |
develop/perl/mssql.1321233567.txt.gz · 마지막으로 수정됨: 2011/11/14 10:19 저자 starlits