티스토리 뷰

1. sudo apt-get install freetds-common freetds-bin unixodbc php5-sybase

 

2. sudo /etc/init.d/apache2 restart

 

3. sudo vim /etc/freetds/freetds.conf

 

[yourserver]
host = your.server.name
port = 1433
tds version = 8.0

 

 

4. tsql -S yourserver -U yourusername -P yourpassword -D yourdatabasename

 

5. 테스트 PHP


$link = mssql_connect('yourserver', 'yourusername', 'yourpassword');
 
if (!$link)
    die('Unable to connect!');
 
if (!mssql_select_db('yourdatabasename', $link))
    die('Unable to select database!');
 
$result = mssql_query('SELECT * FROM yourtable');
 
while ($row = mssql_fetch_array($result)) {
    var_dump($row);
}
 
mssql_free_result($result);

 

 

댓글