Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 13-10-2008, 09:49 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Nov 2007
Posts: 18
Question jdbc connection with oracle


hi folks i want to connect java application program with oracle 10g express edition . i tried hell lot of times but it showing classnotfound exception.i dont know which driver to use whether oci or thin driver.i also set classpath for oracle14.jar in environment varibles.i dont know wats the problem. can any of u help me regarding this.pls reply asap.thankx in advance folks.plssssssssssssssssssssssssssssss.....
vijay_ss2004 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 14-10-2008, 11:12 AM   #2 (permalink)
In The Zone
 
ruturaj3's Avatar
 
Join Date: Feb 2007
Location: Mumbai
Posts: 214
Default Re: jdbc connection with oracle

Post ur program. May be some thing wrong with ur coding.
chk this
http://www.java-tips.org/other-api-t...ng-jdbc-4.html

Last edited by ruturaj3; 14-10-2008 at 11:17 AM.
ruturaj3 is offline  
Old 16-10-2008, 06:44 AM   #3 (permalink)
Right Off the Assembly Line
 
Join Date: Nov 2007
Posts: 18
Red face Re: jdbc connection with oracle

yeah this was my code can u find wats thw error is

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager.*;
import java.sql.*;
public class simple
{
public static void main(String args[]) throws SQLException,ClassNotFoundException
{
try
{
//DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbcracleci:@ XE","system","vijay");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from sample");
while(rs.next())
{
System.out.println(rs.getString(1));
System.out.println(rs.getInt(2));
}
con.close();
}
catch(SQLException e)
{
System.out.println(e.getMessage());
}
}
}

pls suggest me wat to do ....................thankx in advance ....

after executing the above program i m getting
C:\Program Files\Java\jdk1.5.0\bin>java -classpath . simple
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.
OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at simple.main(simple.java:15)
pls help folks...................

Last edited by vijay_ss2004; 16-10-2008 at 08:05 AM. Reason: Automerged Doublepost
vijay_ss2004 is offline  
Old 16-10-2008, 03:05 PM   #4 (permalink)
Broken In
 
Join Date: Aug 2008
Location: Mumbai, India
Posts: 169
Default Re: jdbc connection with oracle

Why are you specifying the classpath when compiling the source?

Make it as your environment variable and make sure that your classes12.zip (or whatever) is in your classpath.
Bandu is offline  
Old 16-10-2008, 03:41 PM   #5 (permalink)
Excessive happiness
 
furious_gamer's Avatar
 
Join Date: Jun 2008
Location: Bangalore
Posts: 2,975
Default Re: jdbc connection with oracle

ClassNotFoundException insense means that the compiler was unable to find the Oracle Driver file....Make sure u copy that file and paste it in ur classpath...
__________________
My First Android phone : Samsung Galaxy SL i9003 - Rooted & Gingerbread XXKPQ
Updated : superteekz_V2 ROM for XXKPQ.

PS Request
furious_gamer is online now  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle Unveils Oracle(r) Virtual Machine Garbage Technology News 2 15-11-2007 06:58 PM
Want a basic mobile and connection for net connection Chetan1991 Mobiles and Tablets 5 31-10-2007 11:13 AM
Oracle Versions and Supported OSs etc., about Oracle sravan_mdo Software Q&A 1 27-08-2006 05:59 PM
Learn :: USING JDBC(with ACCESS), AWT, & SWING in JAVA(JDK 1.5) imdbest Tutorials 1 11-07-2006 11:47 AM
JDBC saro_gn QnA (read only) 1 27-04-2006 02:36 PM

 
Latest Threads
- by Sujeet
- by gforz
- by soumya

Advertisement




All times are GMT +5.5. The time now is 03:15 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2