Tuesday, May 24, 2011

Adding JDBC driver on Eclipse IDE for JAVA


I am using Eclipse on Ubuntu 10
Oracle 10G Xpress Edition


Link to download Jdbc drivers for Oracle Database 10g 10.1.0.2 

http://www.oracle.com/technetwork/database/enterprise-edition/jdbc101040-094982.html


Let's assume you have created an Eclipse  project called Java_project  and you want to connect to Oracle. You need to tell Eclipse where to find the jdbc driver file for Oracle. To do that you should do the following:
  • In the Java perspective right-click the project name in the Package Explorer window.
  • In the pop-up menu choose Properties
  • On the left  list of the new window choose Java Build Path
  • On the right part of the window choose the Libraries
  • Click the Add External JARs button
  • In the file chooser search and find the zip file
        /home/o/oracle/jdbc/bin/classes12.zip
  • Click Open to add it to Libraries.
Now you can close the properties window and go back to your project. You should be able to connect to Oracle.

Also check this link :

http://www.ugrad.cs.ubc.ca/~cs304/2009W2/tutorials/JDBC/OracleFromEclipse.htm


I added the below two files :

ojdbc14.jar
classes12.jar









Monday, May 23, 2011

Multi Dimension Array Test Program

========================================
package java_demo;

public class MultiDimenDemo {

    /**
     * @param args
     */
    public static void main(String[] args) {
        String[][] names = {{"Mr. ", "Mrs. ", "Ms. "},
                            {"Smith", "Jones"}};
        System.out.println(names[0][0] + names[1][0]); //Mr. Smith
        System.out.println(names[0][2] + names[1][1]); //Ms. Jones
    }
}


=========================================

Out Put:
Mr. Smith
Ms. Jones


How arrays pick up :

{{"Mr. ", "Mrs. ", "Ms. "}, ---> [0][0] , [0][1] , [0][2],
  {"Smith", "Jones"}};       ----> [1][0] , [1][1]



[0][0] , [0][1] , [0][2], [0][3], [0][4]
[1][0] , [1][1] , [1][2], [1][3], [1][4] 



Good Article on JAVA!
http://download.oracle.com/javase/tutorial/java/index.html






Sunday, May 22, 2011

Error running project in JDeveloper - "java.sql.SQLDataException: ORA-01882: timezone region not found"


This error is not related to system time.

Fix: heres what I did,

In  Jdeveloper, 

Will need to modify settings below two places.

1) Applications -> Default Project Properties

2) Application -> Project projecties

Run/DEBUG/PROFILE -> select Default, click edit


add  -Duser.timezone=GMT  (Under Java Options)



This Solves the Problem !!


























Wednesday, April 27, 2011

Copying Symlinks in directories with actual ones !

[root@Linux sriram]# cp jdk6/ /home/sriram -rf -L


This will copy the actual files under jdk6 folder of  the softlinks.

i.e : soft links will be gone and actual files will be present.



Tuesday, April 26, 2011

How to find your Oracle SID

To find what your Oracle System ID is :

SQL> show parameter db_name;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_name                  string     host91906
SQL>


on Oracle XE db usually by default SID is XE , as below

SQL> show parameter db_name;

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_name                  string     XE
SQL>






Some default passwords Oracle DB !!


These are default passwords, you can use to login on a newly installed
Oracle DB !!

SQL> connect system as sysdba;
Enter password: manager
Connected.



SQL> connect sys as sysdba;
Enter password: change_on_install
Connected.

SQL> connect orcladmin as sysdba;
Enter password: welcome
Connected.
SQL>


Name Password
sys change_on_install
system manager
orcladmin welcome

Thursday, April 7, 2011

on VNC connection opening GUI screen fails ...

Loaded component definition: enterprise
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

Exception in thread "Main Thread" java.lang.InternalError: Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.


All i did was :


1) killed that vnc session:(vncserver -kill :1)
2) started a new session (vncserver)
3) su <user>
4) xhost + 
[root@host1 ~]# xhost +
access control disabled, clients can connect from any  host



Thats it! then I was able to load the GUI interface on VNC.