connect.php 410 字节
Newer Older
1 2 3 4 5 6
<?php

use TDengine\Connection;
use TDengine\Exception\TDengineException;

try {
D
dingbo 已提交
7
    // instantiate
8 9 10 11 12 13 14
    $host = 'localhost';
    $port = 6030;
    $username = 'root';
    $password = 'taosdata';
    $dbname = null;
    $connection = new Connection($host, $port, $username, $password, $dbname);

D
dingbo 已提交
15
    // connect
16 17
    $connection->connect();
} catch (TDengineException $e) {
D
dingbo 已提交
18
    // throw exception
19 20
    throw $e;
}