Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Tuesday, August 4, 2009

mysql -- attaching to a host

#This is a way checking your connection to a mysql db server

mysql --user=username -h hostname -p

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";

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

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'