Monthly Archives: January 2009

Select Posts within a Wordpress Category in MySQL

My SQL knowledge is fairly basic. I am an interactive designer, not a strict low-level coder, so I am looking for solutions that do not require cryptic or highly detailed SQL, when I want to access a DB system.
If you want to access the WP MySQL database tables, you can of course include the […]

Protecting a download using a unique URL

A client asked me to develop a simple method for protecting a download (or digital product) by generating a unique URL that can be distributed to authorized users via email. The URL would contain a key that would be valid for a certain amount of time and number of downloads. The key will […]

More on optimization

There’re many articles around the internet related to MySQL optimization, fine tunning my.cnf to achieve a better performance.
After reading hundreds of articles, I found that, none of these are really useful if you have a poor designed database / table structure. And if you have a really well designed database, the default configurations are already […]

The Merits of a Virtual Dedicated Server and Why You Might Need One

I’m really enamored with my virtual dedicated server account with GoDaddy.com. It’s pretty invaluable and really makes my life much easier as a developer and a content producer. Interactive websites really need a core back-end that’s flexible and can do what you want / need, without requiring phone calls to tech support to […]

Cycling

How to detect cycling records in 9i, remember CONNECT BY NOCYCLE does not exist in 9i

SQL> create table lsc_t as
2 select 1 parent, 2 child from dual
3 union all select 2,3 from dual
4 union all select 4,5 from dual
5 union all select 5,6 […]

where is my database link listed?

$ sqlplus scott/tiger@DEVL
SQL> select * from all_db_links;
no rows selected
SQL> select * from dual@PROD;
D
-
X

Hey, why does this work???
Ok, after some research I found out that this seems to be an implicit loopback database link. The fact that the DEVL database has the global name set to PROD is just to annoy more

SQL> select * from […]

read uncommitted

the default isolation level is READ COMMITTED. It means, a session read the committed data.
Session 1:

SQL> set transaction isolation level read committed;

Transaction set.

Session 2:

SQL> update emp set sal=4000 where ename=’SCOTT’;

1 row updated.

Session 1:

SQL> select sal from emp where ename=’SCOTT’;

SAL
———-
3000

Session 2:

SQL> commit;
Commit […]

Oracle APEX 3.1 installation on Oracle Database 10g XE

I’ve been asked many times if there is possible to install Oracle Application Express on Express Edition of 10g database, both of them being free products. The answer is YES, and the procedure is quite simple, as very well indicated on Oracle website
The steps would be:

Download the latest version from APEX website
Unzip the archive in […]

ERROR: duplicate key violates unique constraint

With Postgres, I was getting a lot of error messages like this when trying to do an INSERT:ERROR: duplicate key violates unique constraint “processing_lanes_pkey”
The issue was that the serial sequence got out of whack somehow. I looked in the database and found the the top processing_lanes_id (the primary key) in the table was 2727, […]

s3 backup + mySql dump

These two open source scripts are very useful when combined with cron:
s3 Tools : http://sourceforge.net/projects/s3tools/
OpenSource tools to access Amazon S3 file storage. s3cmd - unix-like tools to manipulate stored files from the command line, s3fuse - driver to mount the S3 storage locally.
and
automysqlbackup : http://sourceforge.net/projects/automysqlbackup/
A script to take daily, weekly and monthly backups of your […]