首先是 odbcinst.ini 的內容:
[MonetDB] Description = ODBC driver for MonetDB server Driver = /usr/local/lib64/libMonetODBC.so Setup = /usr/local/lib64/libMonetODBCs.so FileUsage = 1
再來是 odbc.ini,
[MonetDB] Description = MonetDB Driver = MonetDB Trace = No TraceFile = Database = demo Host = localhost UserName = monetdb Password = monetdb Port = 50000 ConfigFile =
我們使用 TDBCODBC 進行驗證:
package require tdbc::odbc set connStr "DSN=MonetDB; UID=monetdb; PWD=monetdb;" tdbc::odbc::connection create db $connStr set statement [db prepare {create table person (id integer, name varchar(40))}] $statement execute $statement close set statement [db prepare {insert into person values(1, 'leo')}] $statement execute $statement close set statement [db prepare {insert into person values(2, 'yui')}] $statement execute $statement close set statement [db prepare {SELECT * FROM person}] $statement foreach row { puts [dict get $row id] puts [dict get $row name] } $statement close set statement [db prepare {drop table person}] $statement execute $statement close
沒有留言:
張貼留言