サンプルプログラム
サンプルプログラムの格納場所を確認します。
1.「samples」フォルダを開く
2.「odbc」フォルダを開き、ファイルを確認します。
3.ex1.cをコンパイルしてexeファイルを作成します。
ビルド方法
4.DBMaker Sever を起動します。
(ODBCの登録もお忘れなく)
5.実行結果
+----------------------------------------------------------+
+-------------- Ex1. ODBC example program
---------------+
+----------------------------------------------------------+
1. connect to the database
2. define a permanent table tb1
3. insert 5 tuples into table tb1
4. define another permanent table tb2
5. insert tuples into table tb2
6. execute a select command on tb1
7. fetch all data from tb1
c1 c2
====== ======
1 1
2 1
3 1
4 1
5 1
8. execute a select command on tb2
9. fetch all data from tb2
c1 c2
====== ===========
1 a
2 aa
3 aaa
4 aaaa
5 aaaaa
6 aaaaaa
7 aaaaaaa
8 aaaaaaaa
9 aaaaaaaaa
10 aaaaaaaaaa
10. drop tables tb1 and tb2
11. commit the transaction
12. disconnect from the database
+----------------------------------------------------+
+-- END of ODBC Example ex1 -+
+----------------------------------------------------+
6.サーバーの状態表示
7.ODBCを設定していない場合の実行結果 (おまけ)
+----------------------------------------------------------+
+-------------- Ex1. ODBC example program
---------------+
+----------------------------------------------------------+
1. connect to the database
2. define a permanent table tb1
3. insert 5 tuples into table tb1
4. define another permanent table tb2
5. insert tuples into table tb2
6. execute a select command on tb1
7. fetch all data from tb1
c1 c2
====== ======
-13108 -13108
-13108 -13108
-13108 -13108
-13108 -13108
-13108 -13108
8. execute a select command on tb2
9. fetch all data from tb2
c1 c2
====== ===========
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
-858993460 面面面面面面面面面面面面select
* from tb2
10. drop tables tb1 and tb2
11. commit the transaction
12. disconnect from the database
free statement fail !!
disconnect database fail !!
+----------------------------------------------------+
+-- END of ODBC Example ex1 -+
+----------------------------------------------------+