建立新的資料庫的方法:修改 M5server.bat
rem prepare the arguments to mserver5 to tell it where to put the dbfarm
if "%APPDATA%" == "" goto usevar
rem if the APPDATA variable does exist, put the database there
set MONETDBDIR=%APPDATA%\MonetDB5
set MONETDBFARM="--dbpath=%MONETDBDIR%\dbfarm\danilo"
而後建立新的 ODBC DSN:
接下來就是測試的 Tcl script:
package require tdbc::odbc
set connStr "DSN=MonetDB DSN; 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
db close
沒有留言:
張貼留言