Is is possible to connect Netbean IDE to Oracle XE database. ?

Is is possible to connect Netbean IDE to Oracle XE database using network drivers provided with Netbean.

I m giving following input parameter to Netbean.

Data Input Mode : Field Entry
Driver Name: JAVA DB(Network)
Host:lightweight-ovm
Port:1521
Database:XE
Username:lightweight
Password:eek:racle

When tried connecting the Oracle XE using netbean i have got following error.

ubable to add connection. cannot establish a connection to jdbc:derby://lightweight-ovm:1521/XE
using org.apache.derby.jdbc.ClientDriver(Insufficient data while reading from network - expected a minimum
of 6 byes and received only -1 byrtes. the connection has been terminated.

However i can able to establish connection in jsp pages using following connection string.

Class.forName ("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:eek:racle:thin:mad:localhost:1521:XE", "lightweight", "oracle");

What is wrong here?

--- Updated Post - Automerged ---

Finally i got connected to the database.

Here is what i did .
I have clicked on services node of IDE added Oracle jar file
ojdbc14_g.jar
later for establishing connection i have chosen 1st among following(with no specific intention).
1)oracle thin (with service name)
2)oracle thin (with service ID)
3)oracle thin (with TNS name)

but now i have following queries.

1)which is a stardard jar.
there are total two jdbc jar files.
ojdbc14_g.jar and ojdbc14.jar
even though ojdbc14_g.jar is worked for me .
I would like to know about second jar file
When do we require ojdbc14.jar?
2)What is the difference between 3 methods of connection.
*oracle thin (with service name)
*oracle thin (with service ID)
*oracle thin (with TNS name)
 
_g in the name signifies that the classes were compiled with "javac -g" and contain tracing code. ojdbc14.jar/ojdbc14_g.jar are required to connect to v10.x.x; similarly for v11 onwards, the driver i.e. the required jar name is ojdbc5.jar/ojdbc5_g.jar (compiled with jdk1.5) and ojdbc6.jar/ojdbc6_g.jar (compiled with jdk1.6). It depends on the type of oracle database u are using, find all the related jar's below :

JDBC/UCP Download Page

Also, see the links below

Oracle with JDBC : Connect to an Oracle database with JDBC - Real's Java How-to

Oracle Connection Pooling : Connect to Oracle using a connection pool - Real's Java How-to

Also, when it comes to handling DB, always try to use connection pooling, they are much safer and in most cases you wudn't have to bother about closing connections, statements, recordset etc. etc. Application servers let you configure connection pools within them, and then use it through jndi. Otherwise u shud use standard dbcp drivers from Apache.

DBCP - Overview

In any case, always add the require jar to the classpath/buildpath of the applications.
 
Back
Top