Sunday, May 24, 2009

Java MS Access Primary and Foriegn Key

Here is my problem statement : To Implement these 4 functions 1.// return a list of all the table names in the database // as an ArrayList<string> which looks like: // [tableName1, tableName2, tableName3, ..., tableNameN]

ArrayList<string> getAllTableNames()

2. // return the primary key of a given table

// as an ArrayList<string> with the primary key columns in proper // order

ArrayList<string> getPrimaryKey(String tableName) OR PREFERABLY:

write a method to return all the primary keys of all the tables at once.

3. // for a given table, return a list of 4-tuples which are // the relational constraints from foreign tables into this // table's primary keys. Each 4-tuple looks like this: // [PKTABLE_NAME, PKCOLUMN_NAME, FKTABLE_NAME, FKCOLUMN_NAME]

public ArrayList<arraylist<string>> getTableConstraints(String tableName)

OR PREFERABLY:

write a method to return all the relational constraints of all the tables at once.

4.// return a list of all the columns in the database as // a list of triples. Each triple looks like this: // [TABLE_NAME, COLUMN_NAME, DATA_TYPE]

ArrayList<arraylist<string>> reallyGetColumns()

My PROPOSED SOLUTION: For getting the foreign key relationships you'll have to enable the read permission to system table via access (refer to screenshots). Next :

For getting the foreign key relationships you'll have to enable the read permission to system table vi access (refer to screenshots).

Here are the Function Prototypes that are called :

1. private ArrayList<string> gettablenames(Connection con) throws SQLException

2. private ArrayList<string> getprimarykey(Connection con,String tablename) throws SQLException

3. ArrayList<arraylist><string>> getforeignKeys(Connection con,String tablename) throws SQLException

4. ArrayList<arraylist><string>> reallyGetColumns(Connection con) throws SQLException

Test The application by double clicking the jar. I am also attaching the database that i used to test it.

Here is the Executable To Test. Get it Now (sample Db included). Here is the Source Code And Executable : NetBeans Project

: Eclipse Project

Websphere Application Server CE Support For RAD

Installing the WASCE WTP Server Adapter using the deployable.zip file Installing in Eclipse Europa

1. Visit the welcome page from the Eclipse Update Site for IBM WebSphere Application Server Community Edition (http:// download.boulder.ibm.com/ibmdl/pub/software/websphere/wasce/updates/). 2. Find the deployable.zip package and click the linkage to download it. 3. Make sure Eclipse is not running. 4. Extract this package to your Eclipse directory. 5. Use the Eclipse -clean option after installing the WTP server adapter.

copy as root to the /opt/IBM/SDP directory using type : cd plugins type : cp -r * /opt/IBM/SDP/plugins/ type : cd .. type : cd features type : cp -r * /opt/IBM/SDP/features/

NOTE : There should be no ommission of file error.

then use ./eclipse -clean to rerun RAD

Control Internet Connection Opensuse

Install the small package KINTERNET to control the connection (connect and disconnect from tray).

Install RAD

First install sun-jdk downloaded from here : http://java.sun.com/javase/downloads/index.jsp

NOTE : choose jdk update 13. use ./ to run the jdk setup.

to install rad extract all zips files. now open konsole.

navigate to RAD_SETUP folder. Type : cd .. Type : chmod -R u+x RAD_SETUP Type : cd RAD_SETUP Type : ./launchpad.sh

Thats it you have launched the gui for RAD setup . install with default.

Note : Disconnect internet before starting launchpad.sh

Peice Of Cake!! right

Enabling NTFS On OpenSUSE

http://en.opensuse.org/NTFS

OpenSUSE : For MP3 fans like me

http://opensuse-community.org/Restricted_Formats/11.0

go here install the codecs. just click on link and you will be fine.

DB2 Install on OpenSUSE

To install db2 : go to install software. (Start - > application - > system - > configuration -> install software.)

Put the opensuse dvd in drive and then search for libstdc++ . check libstdc++33 and click accept. it will install from cd in a sec.

then open Konsole (start -> applications) type in : su it will ask for password give it (123 if you created gennext as i told you) now keep the konsole running . Copy the db2 for linux tar file to your home directory (start -> computer -> home) now click on it to open with ark. extract its contents in home.

Now come back to the terminal .

Type : cd expc Type : ./db2setup and then the setup installer GUI will appear. and db2 will install fine.

Configuration Options for db2 :

DAS user : db2admin password : password do not change group or anything else. DB2 Instance Owner : User: work passowrd: 123 Default setting for fenced user. just type in password as 123.

FINISH log into work and then Now on konsole type db2start to start db2 and then db2cc to have the GUI front end like mysql query browser

MULTIBOOTING OPENSUSE 11.1 VISTA

OPENSUSE install

Prerequisite Create a 15 - 20 GB unallocated partition through windows disk management or any partition manager of your choice,

Install:

Installation is pretty straight forward. I prefer to use KDE 4.1 desktop environment. HARDDISK CONFIG : I went for expert config and suggest that you should. You will not see the unallocated space you created there. but dont worry it is usable. click add and create a 600 MB ext 3 partition with mount point /boot. Next Create a 2 GB swap partition and the remaining an ext3 with mount point "/". If you want to access the windows files via opensuse select each of your windows partition and select edit. Next confirm that it says "DO NOT FORMAT" and set its mount point to / mnt/drive_C. the mount point will change as the number of drives are increased. BOOTLOADER CONFIG : when you finish giving all your inputs it displays an anallysis of taks. Select bootloader. switch to bootloader config there. select only 2 options. 1. install bootloader to boot partition 2. install bootloader to MBR

You are done......