Showing posts with label sysadmin. Show all posts
Showing posts with label sysadmin. Show all posts

Sunday, June 14, 2009

Mysql -- get table engine type

Get table engine type

You have to go to the mysql system database 1st

This allows you to see which type of table engine you're using

Common types:

myisam: doesn't support the features listed below for innodb
innodb (default) : supports r-trees (good for spatial extensions), enforces foreign keys, and supports transactions


select table_name, engine from tables where table_schema = "vsn";

Wednesday, June 10, 2009

How to set up Jogre for the web

Set up jdk, apache tomcat, and hsqldb
==============================

apt-get install sun-java6-jdk
apt-get install tomcat5.5 tomcat5.5-wepapps tomcat5.5-admin
apt-get install hsqldb-server

Set up jogre
=========

wget http://voxel.dl.sourceforge.net/sourceforge/jogre/jogre_beta_0.3_bin.zip
cd /opt
unzip ~/jogre_beta_0.3.bin.zip
adduser jogre
chown -R jogre:jogre jogre
su jogre
cd
echo "export CLASSPATH=$CLASSPATH:/usr/share/java/hsqldb.jar:." >> .profile
source .profile
java org.hsqldb.Server &
cd /opt/jogre/server
chmod a+x *.sh


Configuration
==========

./server.sh &

#I prefer the gui; it's easier to just change the db settings with this tool
./administrator.sh &
#Login with admin, admin
#Change the database from xml to hsqldb
#The path to the db is jdbc:hsqldb:hsql://localhost/jogre_hsqldb

#restart the jogre server
killall server.sh
./server.sh &


#With apache tomcat admin (http://localhost:8180/admin), add jogreweb.war

Friday, June 5, 2009

Setting up hsqldb

hsqldb is a java based database server

Install it:

apt-get install hsqldb-server

Create the server.properties and sqltool.rc files in your home folder (sample files should be where hsqldb was installed)

The main jar file is /usr/share/java/hsqldb.jar, which should be in your CLASSPATH when working with hsqldb

Place a link in /usr/share/tomcat5.5/common/lib if you want to use it with tomcat 5.5.

There is a swing utility to test and manage the databases.

Starting the server:

java -cp /path/to/hsqldb.jar org.hsqldb.Server


Database URL:

jdbc:hsqldb:hsql://localhost/mydb

Tuesday, June 2, 2009

Installing Apache Tomcat 5.5

#make sure you add unstable entries to sources.list
apt-get install sun-java6-jdk

apt-get install tomcat5.5
apt-get install tomcat5.5-admin
apt-get install tomcat5.5-webapps

$CATALINA_HOME/webapps/ROOT/index.jsp
/usr/share/tomcat5.5-webapps/ROOT/index.jsp



#it will be listening on port 8180

Debian package manager

#useful Debian/Ubuntu package commands

apt-get install package
apt-get remove package
apt-get update #good for updating your database after editing sources.list
apt-cache search search_string

dpkg --list
dpkg --install program.deb
dpkg --remove program




#Sometimes you have to add this to /etc/apt/sources.list
# etch is a version of Debian, replace with your version

deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib

deb http://ftp.debian.org/debian/ etch main
deb-src http://ftp.debian.org/debian/ etch main

#these are good for install outside packages like java

deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free

Thursday, May 28, 2009

Creating a mysql user and granting privileges

//standard way of creating a user

CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';


//Creating a user and granting privileges:

GRANT ALL PRIVILEGES ON table.* TO 'user'@'localhost' identified by 'password'

//Show privileges for a user:

show grants for 'user'@'localhost'