Wednesday, June 27, 2007

Disabling the SeLinux security

Have you ever encounter an issue conncting to mysql server through JDBC connection. eg: SocketException Check the /etc/selinux/config file and change the SELINUX=disabled.

sample entries...

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

Monday, June 18, 2007

Usefull Oracle commands

1) Creating table space
ssh -X -Y oracle@host
oemapp dbastudio

then use the GUI to create the table space

2) Create database
ssh -X -Y oracle@host
dbca

then use the GUI to create the database

Note: -X -Y options needed for get the GUI

Sunday, June 17, 2007

Upload results of a SQl to a CSV file

1) Method 1 - in the shell

mysql -B -u -p -e 'SELECT foo FROM bar ' | \

perl -F"\t" -lane 'print join ",", map {s/"/""/g; /^[\d.]+$/ ? $_ : qq("$_")} @F ' >> output.csv

2) Method 2 - in mysql promp
SELECT * from Dealers INTO OUTFILE 'orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';