I just realized that I should link unix-odbc library instead of oracle-odbc driver library. The problem has been solved.
For some reasons i need to use odbc to connect oracle on linux. So i got oracle-odbc driver from oracle official website. Then i compile my otl test code and then i got link error like this: undefined reference to SQLSetConnectAttr undefined reference to SQLConnect ... I use nm to check the driver lib symbols then i find there is only unicode api like 'SQLConnectW' in lib file. So how can i fix this problem cause i couldn't find any odbc lib file that contain odbc api like 'SQLConnect' on oracle...