Archive for the ‘Oracle’ Category

oracle with netbeans ide…..

November 8, 2009 Leave a comment

somedays ago one of my friends just ask me that did i know how to connect oracle with netbeans ide?I said yes i know.And i have told some about it and i think that will help him,and also i think why don’t i share this topic in my blog,then the others can know it too.So here it goes..

open your ide. then you will see like this


go to databases, then right click on it.
and go to “new connection”


after that


in the name field select  “new driver”


now you will see something like this:


now click on add button and give it the location of  your oracle driver file
for mine it was:
after adding this jar file your netbeans will automatically do the rest of the work for you.
Now Driver class:oracle.jdbc.OracleDriver
then look at your database url,it will be look like

Now in no.
try first giving
if it don’t work with your driver then try
port number of your server
if you don’t know in which port is your server is active
then see java-oracle
tutorial.After getting the port number write it to in “*3”
in here you have to put session id[SID] from server.If you don’t know the [SID] then you can get it by following above tutorial

For me it was..

Now you have to give the username and password,for which user do you want to connect.
[remember the username and password is for ur database user
e.g like “system”,”manager” is a user ]
for me i have another user ‘saiful103a’ beside system so i give
now connect with ur given username
and see the power of netbeans over oracle..

And that’s it


Categories: Java, Oracle

java oracle connection

July 16, 2009 1 comment

Tomorrow i was trying to connect my java program with oracle server.It was not easy for me to do this.Since i’m a new learner.I google it about half an hour.I read every page that seems to me helpful.Then i finally got the solution.If i describe you,you will be astonished and will say to yourself it is nothing at all.Then let go…

Check your configuration with mine:
OS: Windows Xp
JDK Version: JDK1.6
IDE: Any ide or compiler will work

open ur ide or compiler. now create a new project ‘database’.When you will give ur project name meantime you have to notice that anywhere there is a option that have classpath or not.If there is open your classpath settings.Now add a new class.Locate this class to


If you you don’t have ojdbc14.jar then ojdbc[].jar can work for you.Try it.Or you can download it.From oracle website.

ok,now we locate a class that can connect our jdk with oracle.

If you know in which port your oracle server is active then ok,if not
open you command prompt in your windows
now type lsnrctl status
what have you seen.From results you will find

Listening Endpoints Summary…

now we need the name of SID
Now open your sql+ window from oracle
show parameter db_name

you will get a value [for me it was oracl]

this.So PORT=1521 is your port no.
Now,In your project creat a new file named ‘’

import java.sql.*;

public class database
public static void main(String[] args)
DB db = new DB();
Connection conn=db.dbConnect(
"jdbc:oracle:oci:@localhost:1521:oracl", "username", "pasword");


class DB
public DB() {}

public Connection dbConnect(String db_connect_string,
String db_userid, String db_password)
new oracle.jdbc.OracleDriver());

Connection conn = DriverManager.getConnection(
db_connect_string, db_userid, db_password);

System.out.println("Connection Successful");
return conn;

catch (Exception e)
return null;

And that’s it.And it is definitely worked for me.Hope,will work for you too.Have a nice programming.

Categories: Java, Oracle

Starting oracle..

July 11, 2009 Leave a comment

This semester we are going to do a course named ‘Database System’.Under this course we have to do a database[oracle] lab course.Yes, i was waiting for this course when i first understand what can be done with database.Though i am familiar with mysql but oracle is oracle not mysql.Though my mysql concept will help me to understand.Like, we are going to do sql in first step.And i’ve already completed the half of sql part.Though yet we do not started our lab.And it’s not that so hard.I am loving it.I will post if i came to know new things in it.

Categories: Oracle