RSS feed [root] /database /weblog




login:

password:

title search:




 


Sat Sep 28 10:12:20 GMT 2024

database



(google search) (amazon search)
second
download zip of files only

Wed Jan 30 09:24:04 GMT 2008 From /weblog/database/vendor

oracle cookbook


After default install of oracle at win32, here is the step of creating user:

1) sqlplus /noloh (enter sqlplus shell without login)
2) connect oracle/oracle as sysdba (super user connection)
3) CREATE USER CITY IDENTIFIED BY city DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" PROFILE DEFAULT ACCOUNT UNLOCK;
4) GRANT "CONNECT" TO CITY;
5) GRANT "RESOURCE" TO CITY;
grant dba to CITY;

-- Grant/Revoke system privileges
grant create view to CITY;
grant unlimited tablespace to CITY;

imp CITY/city full=y file=c:\xxxxx.dmp

6) sqlplus city (try login)

About create table space

create tablespace TBL01 datafile 'H:\oracle\oradata\ora9\TBL01.dbf' size 50M extent management local segment space management auto;

Other useful views
1) sys.dba_tablespaces;
2) sys.dba_users
3) v$database
4) dba_data_files
5) v$datafile

Start and stop oracle batch
net start OracleCSService
net start OracleDBConsole[db name]
net start OracleOraDb10g_home1iSQL*Plus
net start OracleOraDb10g_home1TNSListener
net start OracleService[db name]

net stop OracleCSService
net stop OracleDBConsole[db name]
net stop OracleOraDb10g_home1iSQL*Plus
net stop OracleOraDb10g_home1TNSListener
net stop OracleService[db name]

An useful link: http://agents.csie.ntu.edu.tw/Projects/VF/docs/use_oracle.txt

How to install oracle in Redhat 9 - http://www.linuxdevcenter.com/lpt/a/4141

Check store procedure issues: select * from user_errors

If there is join like a.column1 = b.column2, and column1 in DATE datatype while column2 is VARCHAR2 datatype, oracle will auto-cast it in JDeveloper, but always return false if I call that stored procedure using JDBC.

Show plsql function detail implementation: select text from user_source where name = MY_PROCEDURE order by line; - http://forums.oracle.com/forums/thread.jspa?threadID=515948

It is possible to get NullPointerException from oracle driver with IBM JDK... it look like IBM issue - http://www.ibm.com[..]s/forums/message.jspa?messageID=13980641

plsql result caching - http://gojko.net[..]ed-up-database-code-with-result-caching/

Oracle date foramt - http://www.oradev.com/oracle_date_format.jsp

(google search) (amazon search)


Tue Jan 08 13:30:32 GMT 2008 From /weblog/database

query table metadata


Several database using following query:

select column_name, numeric_precision as length, data_type from information_schema.columns where table_name='TEST'

H2, mysql and postgresql support above syntax

http://h2database.com/ipowerb/index.php?act=ST&f=2&t=205

There difference of getColumnName() and getColumnLabel() , for SQL "select name as n from table" getColumnName() with return "n" and getColumnLabel() will return "name" - http://ola-bini.blogspot.com[..]you-using-resultsetmetadatagetcolum.html

(google search) (amazon search)


Mon Jan 07 14:17:37 GMT 2008 From /weblog/database

StoredProc


Nice article of discussing pros and cons of using stored procedures: http://www.richardjonas.com[..]uments-for-and-against-using-stored.html
http://www.developerfusion.co.uk/show/4708/
http://www.lowendahl.net/showShout.aspx?id=142
http://en.wikipedia.org/wiki/Lock-free_and_wait-free_algorithms
http://c2.com/cgi/wiki?LockFreeSynchronization

I still like to prevent it as most SP still look ugly in my own opinons.... here is another article that mostly against SP - http://bloggingabout.net[..]yth-of-stored-procedures-preference.aspx

(google search) (amazon search)


Sat Dec 15 10:42:26 GMT 2007 From /weblog/database

simpledb


Amazon simple DB service

http://highscalability.com/product-amazons-simpledb
http://highscalability.com/current-pros-and-cons-list-simpledb
http://www.artima.com/forums/flat.jsp?forum=276&thread=220863

(google search) (amazon search)


Wed Nov 14 11:05:19 GMT 2007 From /weblog/database

alternatives


An arguement of use / not use RDBMS http://www.cincomsmalltalk.com[..]gView?showComments=true&entry=3366636502 .

Hsql is a very nice tool for development: fast, support most sql standard, easy to setup. In addition, there is a one really nice feature. It will store the INSERT, UPDATE and DELETE statement in a script file to persist the database status. This make debug a lot simpler. Highly recommend!

http://hsqldb.sourceforge.net/

Besides, a nice introduction of SQLite and Java Berkeley DB - http://www-900.ibm.com[..]operWorks/cn/java/l-embed-db/index.shtml

A solution of close don't commit data to disk: http://blog.taragana.com[..]ion-close-doesnt-write-to-disk-solution/ but for me this is feature than bug, as I can easily keep my data back to the copy I want.

A document base DB, it is not hold a table ( or relation ) , it hold a Document , what I understand it is a map - http://www.couchdbwiki.com/index.php?title=Main_Page

(google search) (amazon search)


Mon Oct 15 11:32:55 GMT 2007 From /weblog/database/sql

ansi joining


A nice article about standard ANSI joining syntax:

http://www.oracle.com/technology/oramag/oracle/01-nov/o61sql.html

Recognizing well known patterns involving outer joins will form a ground-level vocabulary for your further explorations of your data. This article examined syntax, surprises, and rules of thumb with respect to the usage of joins.

http://www.onjava.com/lpt/a/4443

A blog with nice graphic show how join work - http://www.codinghorror.com/blog/archives/000976.html

(google search) (amazon search)


Wed Jun 13 15:34:34 GMT 2007 From /weblog/database/sql

solve sudoku in sql


A very complicate TSQL sample... in my opinions: http://www.vsj.co.uk/articles/display.asp?id=540

Even more implementation - http://lambda-the-ultimate.org/node/2291

which introduce some interesting function in vendor specific SQL, like Oracle MODEL - http://download-uk.oracle.com[..]erver.102/b14223/sqlmodel.htm#sthref1855

(google search) (amazon search)


Tue Apr 10 16:51:38 GMT 2007 From /weblog/database

JDBC4


The one I long for is the SQL Exception Handling Enhancements, look like I don't need to issue an select everytime before insert or delete to prevent SQL exception from duplicate record or foreign key constraint

However, not sure why we need Annotation-Based SQL Queries, better than putting SQL as String?

http://www.artima.com/lejava/articles/jdbc_fourP.html
http://java.sys-con.com/read/111252_p.htm
http://javaswamy.blogspot.com/2006/08/jdbc-40-resources.html
http://www.javaspecialists.co.za/archive/newsletter.do?issue=138
http://today.java.net[..]day/2007/04/10/whats-new-in-jdbc-40.html

(google search) (amazon search)


Fri Mar 30 11:22:20 GMT 2007 From /weblog/database/transaction

Transactionless system


Improve scalability via turn off transaction... do you think it will work?

http://martinfowler.com/bliki/Transactionless.html

I think this Idempotency help a lot if we like to implement system in this way: http://www.artima.com/intv/distribP.html or example is soft update http://www.mckusick.com/softdep/

Follow up discussion - http://www.artima.com/forums/flat.jsp?forum=276&thread=200350

Already get two comments from friends, there is the key points:

=== Rob
Not if everything works as intended. But if something goes wrong you might get an unexpected state in the database. Then you have to do more work in other places to deal with the fact that the database might be in a state that wasn't intended, but is theoretically possible because you didn't use transactions.
=== Rex
Rex: exactly the thing what i did in last year to boost up performance from 700 txn per second to more than 10K txn per second.
Carfield Yim: handle rollback yourself you mean?
Rex:
u've to understand what is a system before talking the details...
different application can apply different rollback.
online/batch different are different.

Rule 1. make your txn simple.
if it can't be simple, your design must have problem

u have to understand your capacity & limitation..... such article is meaningless if you have no actual requirement...
if client is requiring 500 txn, that's no pt to have it like that.

(google search) (amazon search)


Fri Dec 15 08:28:23 GMT 2006 From /weblog/database

model tree in set


We usually format tree structure using adjacency list, however, it also able to present in a set. Which spend more work on [create, delete, update] operations, but achieve much better query performance.

http://searchdatabase.techtarget.com[..]com/tip/1,289483,sid13_gci537290,00.html
http://searchdatabase.techtarget.com[..]com/tip/1,289483,sid13_gci801943,00.html
http://www.onlamp.com/lpt/a/5007
http://www.google.com[..]firefox-a&rls=org.mozilla:en-US:official
http://www.anarchogeek.com/archives/000173.html

Java example - http://threebit.net/tutorials/nestedset/tutorial1.html

(google search) (amazon search)


Sun Nov 05 17:50:35 GMT 2006 From /weblog/database

regression test


Automate data test - http://www.ddj.com/dept/architect/193402922?cid=Ambysoft

(google search) (amazon search)


Wed Oct 18 08:17:25 GMT 2006 From /weblog/database

Gotchas


Various problems from various databases

http://sql-info.de/mysql/gotchas.html#1_13

(google search) (amazon search)


Thu Oct 12 09:33:03 GMT 2006 From /weblog/database/objective

Transparent persistent



Transparent Persistence is a marketing term (that means "lie"), it isn't. However, because you need to spend far less effort on persistence you tend to really want it to be true, and code as if it is.
...
Probably, what we all need to do, is to remove the word "transparent" from "transparent o/r mapping" and admit that it is simply a high level tool, be up front about the design considerations, and talk a lot more about how to design applications using these tools rather than what the tools can do.

http://kasparov.skife.org/blog/src/objects-wars-tb.writeback

(google search) (amazon search)


Wed Jun 07 08:40:48 GMT 2006 From /weblog/database

Order-by side effect


Do not use ORDER BY if the query has a DISTINCT or GROUP BY on the same set of terms, because they have the side effect of ordering rows

http://archives.postgresql.org/pgsql-general/2004-12/msg01340.php

(google search) (amazon search)


Sun May 28 10:34:11 GMT 2006 From /weblog/database

jdbc proxy


a list of jdbc proxy: http://opensourcereader.blogspot.com[..]/debugging-jdbc-with-logging-driver.html

(google search) (amazon search)


Fri Jan 20 04:30:07 GMT 2006 From /weblog/database

Managing PetaByte Database


Nice to read: http://nairanand.blogspot.com[..]06/01/worlds-largest-database-babar.html

(google search) (amazon search)


Mon Nov 28 09:33:19 GMT 2005 From /weblog/database

Gavin King interview


Interview Hibernate creator, a nice reading

JPT: Have your original ideas about O/R mapping changed much since you embarked on this project?

Gavin King: I went into this knowing very little about ORM, and even very little about databases. One of my first tasks was to go out and buy a book to learn SQL properly. All my understanding of the problem comes from what our users have taught us over the last two years.

http://www.javaperformancetuning.com/news/interview041.shtml

(google search) (amazon search)


Sat Nov 19 09:23:24 GMT 2005 From /weblog/database

Tip to remove duplication


Fix for: Missing primary key + duplication record + large table

http://www.dbforums.com/t1202202.html

(google search) (amazon search)


Fri Nov 18 04:45:05 GMT 2005 From /weblog/database

Myth Of Data Integrity


A nice blog discuss about data integrity

http://jooto.com/blog/?p=22

(google search) (amazon search)


Wed Oct 26 09:11:22 GMT 2005 From /weblog/database

domain object cache


Discuss about ehcache, I think this is a nice discussion about possible issue of disk base caching (e.g.: persist generated HTML at disk so that don't need to waste time to generate HTML again and again)

http://twasink.net/blog/archives/2005/10/ehcache_dissect_1.html

(google search) (amazon search)


Mon Oct 24 10:16:27 GMT 2005 From /weblog/database

commit before close


Just know that calling Connection.close() can result in either commit or rollback. It depend DBMS only

http://blog.hibernate.org/cgi-bin/blosxom.cgi/2005/10/19

(google search) (amazon search)