Search This Blog

Powered By Blogger

Tuesday, November 23, 2010

The Art of Unix Programming


The Art of Unix Programming

          good to try

Also including C programming traps and pitfalls into the "To Read List"

Saturday, November 20, 2010

Notes to the Final Project for CSC733 Advanced Distributed Database

1. Driver installation

Like the installation of JDBC driver for mysql, installing the JDBC driver for oracle alse needs to follow the same RULE OF THUMB:

extract the compressed archive downloaded and fetch out only the .jar file, and put it into the $JAVA_HOME/jre/lib/ext directory!! NOT $JAVA_HOME or the
so-called CLASSPATH  which is ordinary $JAVA_HOME/jre/lib !!

and for satety you should make the permission 644 for the library (.jar) under this directory.


2. SQL Developer Installation and Connection

After Installing SQLDeveloper(linux X86_64), you may want to use it immediately starting from connecting a DB.
While trying with this following problems might be waiting for you:

a. Firstly you will most possibly come across this DMS gnat:

oracle.classloader.util.AnnotatedNoClassDefFoundError:

  Missing class: oracle.dms.console.DMSConsole

Dependent class: oracle.jdbc.driver.DMSFactory
         Loader: jre.extension:0.0.0
    Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/ojdbc6dms_g.jar
  Configuration: system property java.ext.dirs


this is caused by lack of an essential library, It is DMS!
To fix it, you need to install this library. I just copy dms.jar under the installation directory for
JDeveloper into $CLASSPATH/ext to resolve this bitting problem!


b. after fixing up problem a, another one is there greeting you:

oracle.classloader.util.AnnotatedNoClassDefFoundError:

  Missing class: oracle.core.ojdl.MessageType

Dependent class: oracle.dms.instrument.Level
         Loader: jre.extension:0.0.0
    Code-Source: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext/dms.jar
  Configuration: system property java.ext.dirs

yes, this is another "library missing" problem - lacking ojdl.jar. It is not really the empytiness you might found with
the "core package" in the dms.jar that is the culprit, but the ojdl.jar, completely yet another libraries!

To make up this library, I simply drag it from still the JDeveloper installation directory into $CLASSPATH/ext to make this SQLDeveloper docile!

Now, the connection should be ok!


3. Generate tables and feed random data into the database

Here we make use of BenchMark-SQL-2.3.2 to do this.
However, you ought to find that this tools is not so friendly as you might expect under linux environments. So here goes problems and solutions to those problems as follows:

a. when you firstly try running the script runSQL.sh, you probably get stunned immediately by this error : err.sh: line 1: /bin/java: No such file or directory.
This is occuring just because $JAVA_HOME does not effect at all. To fix this, follow these two simple steps:
1> head lines as follows in runSQL.sh
#!/bin/bash
source ~/.bash_profile
2> convert the script, which is most likely in a DOS format while downloaded, to unix format by dos2unix

b.  You might hit the wall on this error : No suitable driver found!
This is most likely due to incorrect setting for connection in the properties file that the main runSQL.sh script uses. Here is the hopeful solution:

edit the .properties file. Now since we use oracle driver and database, we had better to use oracle.properties under the "run" subdirectory.
Then change things like this:

driver=oracle.jdbc.driver.OracleDriver
#conn=jdbc:oracle:thin:@localhost:1521:XE
#user=scott
#password=tiger
conn=jdbc:oracle:thin:@dia2.cs.usm.edu:1521:dia2
user=xxxxxx
password=*************

note that the value for "conn" is not simply the host name, you should comply with the format above, including driver type, host, port and SID.


c. Following the same solutoion above to beat the same problems you might be confronted with loadData.sh.

Now, you should get all data randomly inserted into the database.