Database setup
[herrold@couch ~]$ sudo yum -y install mysql-server php-mysql Password: ... [herrold@couch ~]$ sudo /sbin/service mysqld start Starting MySQL: [ OK ] [herrold@couch ~]$ mysql -u root -p mysql Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. ... mysql> create database testing_shim ; Query OK, 1 row affected (0.01 sec) mysql> GRANT USAGE ON testing_shim.* TO 'shim'@'localhost' ; mysql> GRANT USAGE ON testing_shim.* TO 'shim'@'%' ; mysql> GRANT SUPER ON *.* TO 'shim'@'%' WITH GRANT OPTION ; mysql> GRANT SUPER ON *.* TO 'shim'@'localhost' WITH GRANT OPTION ; mysql> FLUSH PRIVILEGES; mysql> select * from user where User = 'shim' ; ... much stuff ... mysql> select Host, User, Password, Super_priv from user where User = 'shim' ; +-----------+------+----------+------------+ | Host | User | Password | Super_priv | +-----------+------+----------+------------+ | % | shim | | Y | | localhost | shim | | Y | +-----------+------+----------+------------+ 2 rows in set (0.00 sec)
use mysql ;
delete from user where User = 'shim' ;
GRANT SUPER ON *.* TO 'shim'@'%' WITH GRANT OPTION ;
GRANT SUPER ON *.* TO 'shim'@'localhost' WITH GRANT OPTION ;
GRANT CREATE TEMPORARY TABLES ON *.* TO 'shim'@'%';
GRANT CREATE TEMPORARY TABLES ON *.* TO 'shim'@'localhost';
GRANT USAGE, SELECT, INSERT, CREATE, DROP ON testing.*
TO 'shim'@'localhost' ;
GRANT USAGE, SELECT, INSERT, CREATE, DROP ON testing.*
TO 'shim'@'%' ;
FLUSH PRIVILEGES;
[herrold@couch src]$ pwd
/home/herrold/shim/shim-070202/src
[herrold@couch src]$ grep -A2 '7496' once.c
: tws_port(7496),
tws_host("127.0.0.1"),
channels(c.mode.streams(p, c, f, self)),
[herrold@couch src]$ grep -A3 'localhost' data.c
HostName("localhost"), /* patch */ /* server host (default:localhost ) */
UserName("shim"), /* patch */ /* username (default:login name) */
DbmsName("testing"), /* patch */ /* database name (no default) */
PassWord(""), /* patch */ /* password (no default) */
[herrold@couch src]$
... and a quick 'make' up a directory (we had built this before, so we
'touch' the two files, so that they are preceived as stale by 'make' as it
processes the supplied Makefile).And let's test it, first without populating the database, AND without starting a TWS enabled to listen on its '127.0.0.1'[herrold@couch src]$ cd .. [herrold@couch shim-070202]$ touch src/data.c src/once.c [herrold@couch shim-070202]$ make make -j8 shim make[1]: Entering directory /home/herrold/shim/shim-070202' distcc g++ -Wall -g -I/usr/include/mysql -c -o once.o src/once.c distcc g++ -Wall -g -I/usr/include/mysql -c -o data.o src/data.c date; distcc g++ -g -o shim once.o make.o init.o mode.o data.o type.o rule.o kind.o help.o else.o boot.o atom.o load.o shim.o time.o read.o flow.o next.o send.o post.o wire.o echo.o term.o leaf.o call.o hash.o pool.o unit.o -L/usr/lib/mysql -lmysqlclient -lm Sun Feb 4 19:42:22 EST 2007 make[1]: Leaving directory /home/herrold/shim/shim-070202' [herrold@couch shim-070202]$
which is of course expected, and documented elsewhere (toward the bottom).[herrold@couch shim-070202]$ ./shim --data Usage: shim[optional feature list] ... terminate called after throwing an instance of 'TradingShimDaemon1_0::TradingException::my_sql_initialize_failure' Aborted [herrold@couch shim-070202]$
And, and then test again[herrold@couch shim-070202]$ cd sql [herrold@couch sql]$ mysql -u shim -h localhost testing_shim < create.sql [herrold@couch sql]$ cd ..
Success -- setting up logging, as into a pipe, so that we can watch the shim's interaction with the TWS comes next.[herrold@couch shim-070202]$ ./shim --data The trading shim has finished program initialization, including the construction of successful connections to the database and IB tws. quit; [herrold@couch shim-070202]$
[ Home |
Search
|
Interior documentation |
Program documentation
|
FAQ |
Download |
PDFs |
Screen shots ]
[ Contact Us |
Site Map |
Bugzilla |
Mailman
|
Mailing List Archives: (Main)
|
License |
About |
Press |
Copyright ]