NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

jdbc with oracle in netbeans
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
tashe



Joined: 23 Oct 2008
Posts: 1

PostPosted: Thu Oct 23, 2008 9:06 am    Post subject: jdbc with oracle in netbeans Reply with quote

I have installed NetBeans 6.1 recently. In the last couple of days I'm trying to make a Java aplication to connect to my Oracle 10g database.
I have jdk 1.6 installed.

I followed some instructions on the web about driver installation. I did the following:
I've put ojdbc6.jar into C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
and orai18n.jar into C:\oraclexe\app\oracle\product\10.2.0\server\jlib .
I added them both to the CLASSPATH variable.

I also wrote the following code in NetBeans:

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e) { System.out.println("Oops! Can't find classoracle.jdbc.driver.OracleDriver");
}
try{
Connection con=null;
con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe",
"SYS",
"460004");
Statement s=con.createStatement();
s.execute("INSERT INTO PERSON VALUES (1,'Mite','Tashev') ");

}catch(Exception e){System.out.println("Second Exception: "+e.toString());}

It builds the app succesfully but displays both exceptions:

Oops! Can't find classoracle.jdbc.driver.OracleDriver
Second Exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521:xe

Does anyone knows what should I do?
Maybe some settings in NetBeans?
thanks in advance
Back to top
dms



Joined: 22 Oct 2008
Posts: 4

PostPosted: Thu Oct 23, 2008 11:42 am    Post subject: jdbc with oracle in netbeans Reply with quote

Is this a standalone Java application? If so, you need to put the
oracle driver class jar into the applications classpath. Right click
on your project in the project explorer, choose Properties |
Libraries and add the driver class file there.

Dave.


On 23 Oct 2008, at 10:06, tashe wrote:

Quote:
I have installed NetBeans 6.1 recently. In the last couple of days
I'm trying to make a Java aplication to connect to my Oracle 10g
database.

I have jdk 1.6 installed.



I followed some instructions on the web about driver installation.
I did the following:

I've put ojdbc6.jar into C:\oraclexe\app\oracle\product\10.2.0
\server\jdbc\lib

and orai18n.jar into C:\oraclexe\app\oracle\product\10.2.0\server
\jlib .

I also wrote the following code in NetBeans:



try {

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundException e) { System.out.println("Oops! Can't
find classoracle.jdbc.driver.OracleDriver");

}

try{

Connection con=null;

con=DriverManager.getConnection(

"jdbc:oracle:thin:@localhost:1521:xe",

"SYS",

"460004");

Statement s=con.createStatement();

s.execute("INSERT INTO PERSON VALUES (1,'Mite','Tashev') ");



}catch(Exception e){System.out.println("Second Exception:
"+e.toString());}



It builds the app succesfully but displays both exceptions:



Oops! Can't find classoracle.jdbc.driver.OracleDriver

Second Exception: java.sql.SQLException: No suitable driver found
for jdbc:oracle:thin:@localhost:1521:xe



Does anyone knows what should I do?

Maybe some settings in NetBeans?

thanks in advance




Back to top
unodos



Joined: 29 Oct 2008
Posts: 5

PostPosted: Wed Oct 29, 2008 4:06 am    Post subject: sugest Reply with quote

The second exception is thrown because the driver couldn't be loaded, so first you need to successfully execute the code inside the try.

Exapnd the project node right click on librarys and add
Code:
ojdbc14_g.jar
, class name is:
Code:
oracle.jdbc.driver.OracleDriver
, url is
Code:
jdbc:oracle:thin:@<server>[:<1521>]:<database_name>



You can find ojdbc14_g.jar somewhere inside the installation folder of your oracle db




Tell me if you solve the problem
Back to top
fish1ric



Joined: 30 Oct 2008
Posts: 4

PostPosted: Thu Oct 30, 2008 12:24 pm    Post subject: jdbc with oracle in netbeans Reply with quote

I also can not connect to Oracle 10G via Netbeans 6.1 or 6.5RC2.
I have tried several Oracle driver versions (ojdbc14.jar, ojdbc6_g.jar*)
* ojdbc6 has a broken manifest file that you must fix first.

The error is that it can't find the listener.
Put the Oracle jar files in the NetBeans 6.5 RC2\ide10\modules\ext and added it to the path and classpath.

I initially tried using the ojdbc14.jar that all the other apps point to on my local Oracle client install. (C:\oracle\ora10g\jdbc\lib)

I have no trouble connecting with TOAD, Sql*Plus, SQuirreL SQL Client (jdbc java db client), Eclipse etc.

Can someone please tell me how to make this work in Netbeans.
jdbc:oracle:thin:@oradbtgd:1521:tgd is the format of the connection string.
I have also tried the IP address of the db server as well as tgd.world for the SID.

Thanks
Back to top
Wouter van Reeven
Posted via mailing list.





PostPosted: Thu Oct 30, 2008 12:34 pm    Post subject: jdbc with oracle in netbeans Reply with quote

On Thu, Oct 30, 2008 at 12:24:35PM +0000, fish1ric wrote:
Quote:
Can someone please tell me how to make this work in Netbeans.

jdbc:oracle:thin:@oradbtgd:1521:tgd is the format of the connection string.

I have also tried the IP address of the db server as well as tgd.world for the SID.

As far as I can tell you're doing the right thing. I never put the jdbc jar in a
"special" place. And NetBeans has been able to connect to my Oracle database
ever since version 5.0. The connection URL you use also is correct. What driver
does NetBeans use? I use the default suggested value, which is
oracle.jdbc.OracleDriver.


HTH, Wouter van Reeven

--

People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"
Back to top
John Baker
Posted via mailing list.





PostPosted: Thu Oct 30, 2008 4:59 pm    Post subject: jdbc with oracle in netbeans Reply with quote

The supported driver is ojdbc14.jar available from this page from
http://wiki.netbeans.org/DatabasesAndDrivers#section-DatabasesAndDrivers-OracleDriverForTheOracle10.xDatabase

To register a driver, in the Services tab, expand Databases, right-click
on Drivers and choose New Driver.

In the New Driver dialog, the driver class is oracle.jdbc.OracleDriver
and the name is Oracle Thin

John

fish1ric wrote:
Quote:
I also can not connect to Oracle 10G via Netbeans 6.1 or 6.5RC2.

I have tried several Oracle driver versions (ojdbc14.jar, ojdbc6_g.jar*)

* ojdbc6 has a broken manifest file that you must fix first.



The error is that it can't find the listener.

Put the Oracle jar files in the NetBeans 6.5 RC2\ide10\modules\ext and added it to the path and classpath.



I initially tried using the ojdbc14.jar that all the other apps point to on my local Oracle client install. (C:\oracle\ora10g\jdbc\lib)



I have no trouble connecting with TOAD, Sql*Plus, SQuirreL SQL Client (jdbc java db client), Eclipse etc.



Can someone please tell me how to make this work in Netbeans.

jdbc:oracle:thin:@oradbtgd:1521:tgd is the format of the connection string.

I have also tried the IP address of the db server as well as tgd.world for the SID.



Thanks




Back to top
HASSAN Kamrul
Posted via mailing list.





PostPosted: Thu Oct 30, 2008 7:46 pm    Post subject: JDBC with oracle in netbeans 6.1 - Table does not associate with drop-down list control Reply with quote

I have a similar issue.
* I put Oracle9i 9.2.0.8 JDBC Drivers for use with JDK 1.4 (ojdbc14.jar) [driver for JDK 1.5/1.6 is not listed]
into C:../JDBC/oracle/ojdbc14.jar then I created DB connection as you mentioned below. I see all table and views and etc.
But when drop a table into drop-down list control it does not associate it,
when (after dropping table) right-click then Bind to Data.. I see blank on Value and Display field
My data source is Oracle Release 9.2.0.7.0 and I am using Netbeans 6.1 (with JDK 1.6)

[img]No%20AttachName[/img]
Thank you.
Kamrul Hassan
Alcatel-Lucent
GNOC IT Development and Architecture
(972) 477 8792
address-removed


-----Original Message-----
From: address-removed [mailto:address-removed ([email]address-removed[/email])]
Sent: Thursday, October 30, 2008 11:59 AM
To: address-removed
Subject: Re: [nbj2ee] jdbc with oracle in netbeans

The supported driver is ojdbc14.jar available from this page from http://wiki.netbeans.org/DatabasesAndDrivers#section-DatabasesAndDrivers-OracleDriverForTheOracle10.xDatabase
To register a driver, in the Services tab, expand Databases, right-click on Drivers and choose New Driver.
In the New Driver dialog, the driver class is oracle.jdbc.OracleDriver and the name is Oracle Thin
John
fish1ric wrote:
Quote:
I also can not connect to Oracle 10G via Netbeans 6.1 or 6.5RC2.

I have tried several Oracle driver versions (ojdbc14.jar,
ojdbc6_g.jar*)

* ojdbc6 has a broken manifest file that you must fix first.



The error is that it can't find the listener.

Put the Oracle jar files in the NetBeans 6.5 RC2\ide10\modules\ext and added it to the path and classpath.



I initially tried using the ojdbc14.jar that all the other apps point
to on my local Oracle client install. (C:\oracle\ora10g\jdbc\lib)



I have no trouble connecting with TOAD, Sql*Plus, SQuirreL SQL Client (jdbc java db client), Eclipse etc.



Can someone please tell me how to make this work in Netbeans.

jdbc:oracle:thin:@oradbtgd:1521:tgd is the format of the connection string.

I have also tried the IP address of the db server as well as tgd.world for the SID.



Thanks




Back to top
fish1ric



Joined: 30 Oct 2008
Posts: 4

PostPosted: Tue Nov 18, 2008 1:42 pm    Post subject: jdbc with oracle in netbeans Reply with quote

I downloaded a fresh jar, put the jar at the root of C: and tried all of this
again with the same result.
Long connection try wait and message,
Unable to add connection. ...The Network Adapter could not establish the
connection.
Any ideas?

http://www.nabble.com/file/p20559841/connectError.png

The supported driver is ojdbc14.jar available from this page from
http://wiki.netbeans.org/DatabasesAndDrivers#section-DatabasesAndDrivers-OracleDriverForTheOracle10.xDatabase

'To register a driver, in the Services tab, expand Databases, right-click
on Drivers and choose New Driver.

In the New Driver dialog, the driver class is oracle.jdbc.OracleDriver
and the name is Oracle Thin'
http://www.nabble.com/file/p20559841/connectError.png connectError.png
--
View this message in context: http://www.nabble.com/jdbc-with-oracle-in-netbeans-tp20128198p20559841.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
Back to top
Wouter van Reeven
Posted via mailing list.





PostPosted: Tue Nov 18, 2008 2:26 pm    Post subject: jdbc with oracle in netbeans Reply with quote

On Tue, Nov 18, 2008 at 05:42:48AM -0800, RFDot wrote:
Quote:
I downloaded a fresh jar, put the jar at the root of C: and tried all of this
again with the same result.
Long connection try wait and message,
Unable to add connection. ...The Network Adapter could not establish the
connection.
Any ideas?

http://www.nabble.com/file/p20559841/connectError.png

The supported driver is ojdbc14.jar available from this page from
http://wiki.netbeans.org/DatabasesAndDrivers#section-DatabasesAndDrivers-OracleDriverForTheOracle10.xDatabase

'To register a driver, in the Services tab, expand Databases, right-click
on Drivers and choose New Driver.

In the New Driver dialog, the driver class is oracle.jdbc.OracleDriver
and the name is Oracle Thin'
http://www.nabble.com/file/p20559841/connectError.png connectError.png

I didn't really follow this thread, so forgive me if I ask questions that
already have been asked. Are you sure that the hostname (oradbtgd from the
image) correctly resolves into an IP address? I mean, are you sure there is no
domain or so missing? If you open a command prompt and type

ping oradbtgd

do you get an IP address and pings? Also, does the given SID (tgd from the
image) exist?


HTH, Wouter van Reeven

--

People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"
Back to top
fish1ric



Joined: 30 Oct 2008
Posts: 4

PostPosted: Tue Nov 18, 2008 2:43 pm    Post subject: jdbc with oracle in netbeans Reply with quote

Yes - The ping does resolve to an IP address, the SID exists.
A side note is that Eclipse database explorer works, jdbc SQLirrel DB client
works fine,
Oracle JDeveloper works fine, it is only NetBeans that is having a bit of
trouble here.
I like Netbeans and would like to use it for some items I have but I can't
get past the db connection issues. (It does connect to the local DB that
installs with it).
I have tried putting the driver at the root of C: and in various places
inside of netbeans.



Quote:

'ping oradbtgd

do you get an IP address and pings? Also, does the given SID (tgd from the
image) exist?'



--
View this message in context: http://www.nabble.com/jdbc-with-oracle-in-netbeans-tp20128198p20560946.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
Back to top
fish1ric



Joined: 30 Oct 2008
Posts: 4

PostPosted: Wed Nov 19, 2008 2:04 pm    Post subject: jdbc with oracle in netbeans Reply with quote

Update:

Out of frustration I moved to another machine, installed Java sdk and
netbeans 6.5
and was able to connect right away with the same connection params?
I can't say what is different between the machines but there is a difference
as shown by this test. I sure would like to know what may cause this for
Netbeans
in that all the other 'products' (IDE's and database browsers) connect just
fine.
Until then I will remote over to the machine that works and go from there.



tashe wrote:
Quote:

I have installed NetBeans 6.1 recently. In the last couple of days I'm
trying to make a Java aplication to connect to my Oracle 10g database.

I have jdk 1.6 installed.



I followed some instructions on the web about driver installation. I did
the following:

I've put ojdbc6.jar into
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib

and orai18n.jar into C:\oraclexe\app\oracle\product\10.2.0\server\jlib .

I also wrote the following code in NetBeans:



try {

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundException e) { System.out.println("Oops! Can't find
classoracle.jdbc.driver.OracleDriver");

}

try{

Connection con=null;

con=DriverManager.getConnection(

"jdbc:oracle:thin:@localhost:1521:xe",

"SYS",

"460004");

Statement s=con.createStatement();

s.execute("INSERT INTO PERSON VALUES (1,'Mite','Tashev') ");



}catch(Exception e){System.out.println("Second Exception:
"+e.toString());}



It builds the app succesfully but displays both exceptions:



Oops! Can't find classoracle.jdbc.driver.OracleDriver

Second Exception: java.sql.SQLException: No suitable driver found for
jdbc:oracle:thin:@localhost:1521:xe



Does anyone knows what should I do?

Maybe some settings in NetBeans?

thanks in advance







--
View this message in context: http://www.nabble.com/jdbc-with-oracle-in-netbeans-tp20128198p20580428.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
Back to top
Wouter van Reeven
Posted via mailing list.





PostPosted: Wed Nov 19, 2008 2:08 pm    Post subject: jdbc with oracle in netbeans Reply with quote

On Wed, Nov 19, 2008 at 06:04:18AM -0800, RFDot wrote:
Quote:
Update:

Out of frustration I moved to another machine, installed Java sdk and
netbeans 6.5
and was able to connect right away with the same connection params?
I can't say what is different between the machines but there is a difference
as shown by this test. I sure would like to know what may cause this for
Netbeans
in that all the other 'products' (IDE's and database browsers) connect just
fine.
Until then I will remote over to the machine that works and go from there.

Interesting. Is there any difference in OS, updates that are installed for the
OS and the like? Same network segment, same firewall config etc? Did the second
machine have NetBeans installed before? Just guessing...


Greets, Wouter

--

People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"
Back to top
Jan Pernica
Posted via mailing list.





PostPosted: Thu Nov 20, 2008 7:04 am    Post subject: jdbc with oracle in netbeans Reply with quote

Some of the Oracle driver do work with 32 and some with 64 bit Java. It was my case

Wouter van Reeven wrote:
Quote:
Quote:
On Wed, Nov 19, 2008 at 06:04:18AM -0800, RFDot wrote:
Quote:
Update:

Out of frustration I moved to another machine, installed Java sdk and
netbeans 6.5
and was able to connect right away with the same connection params?
I can't say what is different between the machines but there is a difference
as shown by this test. I sure would like to know what may cause this for
Netbeans
in that all the other 'products' (IDE's and database browsers) connect just
fine.
Until then I will remote over to the machine that works and go from there.

Interesting. Is there any difference in OS, updates that are installed for the
OS and the like? Same network segment, same firewall config etc? Did the second
machine have NetBeans installed before? Just guessing...


Greets, Wouter

--
D
Back to top
Thomas
Posted via mailing list.





PostPosted: Thu Nov 20, 2008 8:09 am    Post subject: jdbc with oracle in netbeans Reply with quote

I had the same problem before, which was caused by Proxy setting in netbeans.
After I disable proxy setting or excluded local network from proxy, it worked.
Wonder if you are have proxy setting in netbeans.


Thomas

2008/11/20 Jan Pernica <address-removed ([email]address-removed[/email])>
Quote:
Some of the Oracle driver do work with 32 and some with 64 bit Java. It was my case

Wouter van Reeven wrote:
Quote:
Quote:
On Wed, Nov 19, 2008 at 06:04:18AM -0800, RFDot wrote:
Quote:
Update:

Out of frustration I moved to another machine, installed Java sdk and
netbeans 6.5
and was able to connect right away with the same connection params?
I can't say what is different between the machines but there is a difference
as shown by this test. I sure would like to know what may cause this for
Netbeans
in that all the other 'products' (IDE's and database browsers) connect just
fine.
Until then I will remote over to the machine that works and go from there.
Interesting. Is there any difference in OS, updates that are installed for the
OS and the like? Same network segment, same firewall config etc? Did the second
machine have NetBeans installed before? Just guessing...


Greets, Wouter

--
D
Back to top
kb9agt



Joined: 06 Nov 2008
Posts: 42

PostPosted: Fri Nov 21, 2008 7:04 pm    Post subject: jdbc with oracle in netbeans Reply with quote

At first glance your database address doesn't look right. This may cause the
same errors you get. I would double check it from services tab.
--
View this message in context: http://www.nabble.com/jdbc-with-oracle-in-netbeans-tp20128198p20627700.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo