PostgreSQL-DB
postgresql-7.3.2 postgresql-7.3.2.tar.gz download => /usr/local/src/pg login:root # emacs /etc/bashrc export ANT_HOME=$JAKARTA_HOME/apache-ant-1.5.2/bootstrap export POSTGRES_HOME=/usr/local/pgsql export PGCLIENTENCODING=EUC_JP export PGDATA=/usr/local/pgsql/data export MANPATH="$MANPATH":/usr/local/pgsql/man export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB" export CLASSPATH=$POSTGRES_HOME/share/java/postgresql.jar:$POSTGRES_HOME/share/java/postgresql-examples.jar :$POSTGRES_HOME/share/java/retepTools.jar export PATH=$JAVA_HOME/bin:$TOMCAT_HOME/bin:$ANT_HOME/bin:$POSTGRES_HOME/bin:$PATH # mkdir /usr/local/pgsql # chown postgres:postgres /usr/local/pgsql # mkdir /usr/local/src/pg # chown -R postgres:postgres /usr/local/src/pg # cd /usr/local/jakarta/apache-ant-1.5.2 login:postgres # cd /usr/local/src/pg # tar xzvf postgresql-7.3.2.tar.gz # cd /usr/local/src/pg/postgresql-7.3.2 # emacs configure-pgsql.sh ./comfigure \ --enable-multibyte=UNICODE \ --enable-locale \ --with-java \ --with-tcl \ --with-openssl=/usr/share/ssl # chmod 755 configure-pgsql.sh # ./configure-pgsql.sh # make ALL of PostgreSQL is successfully made. Ready to install. # make check All 89 tests passed # make install # initdb -E UNICODE # cd /usr/local/pgsql/data # emacs pg_hba.conf host all all 192.168.1.0 255.255.255.0 trust # emacs postgresql.conf tcpip_socket = true port = 5432 (/etc/bashrcをそのまま使用) # emacs /home/postgres/.bashrc if [ -f /etc/bashrc ]; then /etc/bashrc fi # emacs /etc/rc.d/rc.local su - postgres -c "/usr/local/pgsql/bin/postmaster -S -i" # reboot login:postgres # cd /usr/local/src/pg/postgresql-7.3.2/src/test/regress # make runtest # createuser XXXuser y n postgresql.jar http://jdbc.postgresql.org/ postgres $ createdb mabaitdb postgres $ psql mabaitdb < base.sql postgres $ psql mabaitdb < jinzai.sql postgres $ psql mabaitdb < shinamono.sql postgres $ psql mabaitdb mabaitdb-# \d syouhin
postgres $ createdb test # java example.basic jdbc:postgresql://localhost:5432/test XXXuser "" # java example.ImageViewer jdbc:postgresql://localhost:5432/test XXXuser "" PostgreSQL --> initialise --> image --> import --> Remove # java example.Unicode # java example.psql # java -Djdbc.drivers=org.postgresql.Driver uk.org.retep.finder.Main # java example.blobtest postgres $ dropdb test
郵便番号DB (Fedora 3 jdk1.5) ken_all.lzh download => /usr/local/src # cd /usr/local/src # emacs conv.sh #!/bin/sh nkf -S -w -Lu ken_all.csv | gawk 'BEGIN { FS=","; OFS="," } {print $3, $7, $8, $9, $4, $5, $6; }' | \ iconv --from-code=EUC-JP --to-code=UTF-8 | \ gawk '{ gsub("[\"]",""); print; }' > postno.csv # chmod 755 conv.sh # ./conv.sh nkf S-JIS -> UTF-8 変換 gawk FS="入力時のフィールド区切り" OFS="出力時のフィールド区切り" $3 郵便番号 $4 都道府県 カナ $7 都道府県 漢字 $5 市区町村 カナ $8 市区町村 漢字 $6 町域 カナ $9 町域 漢字 # chown postgres:postgres postno.csv # su postgres # emacs post_code.sql create table post_code_tb ( post_no char(7) primary key, --郵便番号 ken_kanj text, --都道府県 shi_kanj text, --市区町村 cyou_kanj text, --町域 ken_kana text, --都道府県カナ shi_kana text, --市区町村カナ cyou_kana text --町域カナ ); # createdb mabait # psql -l # psql mabait # psql mabait < post_code.sql # psql mabait # mabait=# \encoding euc_jp # mabait=# copy post_code_tb from '/usr/local/src/postno.csv'using delimiters ','; # mabait=# select * from post_code_tb; # mabait=# \q
Netbeans IDE 4.0 JDBC Postgresql ツール ライブラリマネージャ 新規ライブラリ jar/フォルダを追加 実行時 データベース ドライバー ドライバーを追加 追加 手順の流れ画面 郵便番号検索 JDBCのテスト post-code.jar download => /usr/local/src # java -jar post-code.jar 実行画面
OpenOffice JDBC Postgresql OOo_1.1beta_LinuxIntel_install.tar.gz download => /usr/local/src # cd /usr/local/src # tar xvfz OOo_1.1_LinuxIntel_install.tar.gz # cd install # ./setup 追加編集 # emacs /root/OpenOffice.org1.1Beta/user/config/javarc /usr/local/pgsql/share/java/postgresql.jar # cd /root/OpenOffice.org/program # ./scalc Tools -> DataSource -> NewDataSource -> General -> JDBC -> Tables -> Queries -> NweQueries -> Save TOOL画面
CSV-DATA_IN_OUT 1行1レコードでカラム間はタブ1個 test=> \cppy testable from '/usr/local/src/testb.csv' using delimiters ','; test=> \cppy testable to '/usr/local/src/testb.csv' using delimiters ',';
BAKUP-DB pg_dump postgres $ pg_dump testdb > testdb.out postgres $ createdb testdb postgres $ psql -e testdb < testdb.out BAKUP-ALL pg_dumpall postgres $ pg_dumpall -o > dball.out postgres $ psql -e template1 < dball.out
PgAccess pgaccess-0.98.7.tar.gz download => /usr/local/src (Tcl/Tk versions 8.0.x) # cd /usr/local/src # tar xzvf pgaccess-0.98.7.tar.gz -C /usr/local # cd /usr/local/pgaccess # ./pgaccess 実行画面
XMLPGSQL XmlpgDocument xmlpgsql.2.0.tar.gz download => /usr/local/src/pg/xml 2002apr-xmlpgsql-ch3.lzh download => /usr/local/src/pg lha-114i.tar.gz download => /usr/local/src # cd /usr/local/src # tar xzvf lha-114i.tar.gz # cd lha-114i # make # cp ./src/lha /usr/local/bin # cd /usr/local/src/pg/xml # tar xzvf xmlpgsql.2.0.tar.gz # autoconf # emacs Makefile.in (-I /usr/local/src/pg/postgresql-7.2/src/include) # emacs install.sh.in # emacs configure-xmlpg.sh ./configure \ --with-postgres-libdir=/usr/local/pgsql/lib \ --with-postgres-includedir=/usr/local/src/pg/postgresql-7.2/src/include # chmod 755 configure-xmlpg.sh # ./configure-xmlpg.sh # make # make install # cd /usr/local/xmlpgsql login:postgres # createdb xmlpgsqldb # psql xmlpgsqldb < xmlpgsql-2.0.1.sql
XML-DB (スキーマ言語 RELAX ) Relaxer setup.zip download => /usr/local/src # cd /usr/local/src # java -jar relaxer016.zip (setup.zip) enter enter yes # chmod 755 /usr/local/bin/relaxer # relaxer -version # relaxer -jdbc xmldb.rlx
pgadmin3 pgadmin3-src-20040620.tar.gz download => /usr/local/src wxGTK-2.5.2.tar.bz2 download => /usr/local/src # cd /usr/local/src # tar Ixvf wxGTK-2.5.2.tar.bz2 # cd wxGTK-2.5.2 # emacs configure-wx.sh ./configure \ --with-gtk \ --enable-gtk2 \ --enable-unicode \ --disable-shared \ --enable-debug # chmod 755 configure-wx.sh # ./configure-pgadmin.sh # make # sudo make install cd contrib/src/stc make sudo make install cd ../xrc/ make sudo make install # cd /usr/local/src # tar xzvf pgadmin3-src-20040620.tar.gz # cd pgadmin3-1.1.0 # emacs configure-wx.sh ./configure \ --with-pgsql=/usr/local/pgsql --enable-static --enable-debug # chmod 755 configure-pgadmin.sh # ./configure-pgadmin.sh make all sudo make install