01 November, 2007

Oracle XE installation problem

Have a problem with Oracle Database 10g Express Edition?
Oracle is installed but doesn't work?

This is caused by that your account is given from domain server or your system has non-English locale.

HowTo resolve this problem:

  1. Create local user (this user should not be a domain account).


  2. Set OS system locale to English (US or UK, via Regional and Language Options), reboot.


  3. Install Oracle XE under local user (via runas console program or via Run as... from Windows Explorer popup menu).


  4. Open file "Oracle\app\oracle\product\10.2.0\server\NETWORK\ADMIN\sqlnet.ora
    and comment (via # symbol) or remove line SQLNET.AUTHENTICATION_SERVICES = (NTS)


  5. Open shell, type sqlplus oracle_user/oracle_password and work with Oracle XE.

31 October, 2007

HowTo create LDAP users

LDAP (Lightweight Directory Access Protocol) - not lightweight for my brain.

After some research I found steps how to store users in the LDAP (OpenLDAP server) under Windows.


  1. Change configuration file

    slapd.conf

    ucdata-path ./ucdata
    include ./schema/core.schema
    include ./schema/cosine.schema
    include ./schema/inetorgperson.schema
    include ./schema/misc.schema
    include ./schema/nis.schema
    include ./schema/openldap.schema


    pidfile ./run/slapd.pid
    argsfile ./run/slapd.args

    access to *
    by self write
    by users read
    by anonymous read

    #######################################################################
    # BDB database definitions
    #######################################################################

    database bdb
    suffix "o=sample company"
    rootdn "cn=Manager,o=sample company"
    rootpw secret
    directory ./data
    index objectClass eq

  2. Restart LDAP service

    restart.bat

    net stop OpenLDAP-slapd
    net start OpenLDAP-slapd

  3. Create base record

    base.ldif

    dn: o=sample company
    objectclass: organization
    objectclass: top
    o: sample company

  4. Insert base record into LDAP

    base.bat

    @echo off
    set LDAP_HOME=E:\devenv\tools\OpenLDAP
    set BASE="o=sample company"
    set D=cn=Manager,%BASE%
    set AUTH=-x -w secret -D %D%

    %LDAP_HOME%\ldapadd.exe %AUTH% -a -f base.ldif

  5. Create file with users' definitions

    user.ldif

    dn: cn=Katrien,o=sample company
    objectClass: top
    objectClass: person
    objectClass: inetorgperson
    cn: Katrien
    sn: none
    userPassword: none
    mail: katrien@samplecompany.com

    dn: cn=Gordon,o=sample company
    objectClass: top
    objectClass: person
    objectClass: inetorgperson
    cn: Gordon
    sn: none
    userPassword: none
    mail: Gordon@samplecompany.com

  6. Insert users into LDAP

    user.bat

    @echo off
    set LDAP_HOME=E:\devenv\tools\OpenLDAP
    set BASE="o=sample company"
    set D=cn=Manager,%BASE%
    set AUTH=-x -w secret -D %D%

    %LDAP_HOME%\ldapadd.exe %AUTH% -a -f user.ldif

  7. Check LDAP records

    search.bat

    @echo off
    set LDAP_HOME=E:\devenv\tools\OpenLDAP
    set BASE="o=sample company"
    set D=cn=Manager,%BASE%
    set AUTH=-x -w secret -D %D%

    %LDAP_HOME%\ldapsearch.exe -LLL %AUTH% -b %BASE% "objectClass=person"

30 October, 2007

MySQL shell scripting

MySQL is the best. The best database server. I love it.
I like and appreciate its simplicity, efficiency, small size, good help, cool shell utilities. And its price :-)

I've worked with MySQL many years. And I can't understand some another database systems like Oracle, that big, heavy and high-priced. I can't stand theirs complexity.



You can use this server as you want. You can embed it into your application.
MySQL also pretty good in the console.

You can execute sql script from file e.g.:

data.sql

insert into Sample (name, address) values ('sample name', 'sample address');



with the simple command:

exec.cmd

@echo off
SET DATABASE_HOST=localhost
SET DATABASE_NAME=db
SET DATABASE_USER=root
SET DATABASE_PASSWORD=********

mysql -h %DATABASE_HOST% -u %DATABASE_USER% -p%DATABASE_PASSWORD% -e "source data.sql" %DATABASE_NAME%


and dump data from database with this command:

dump.cmd

@echo off
SET DATABASE_HOST=localhost
SET DATABASE_NAME=db
SET DATABASE_USER=root
SET DATABASE_PASSWORD=********

md tables
mysqldump --compact --no-create-info --tab=tables -h %DATABASE_HOST% -u %DATABASE_USER% -p%DATABASE_PASSWORD% %DATABASE_NAME%


For these purposes you should have only 2 files from mysql: mysql.exe and mysqldump.exe