A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
java oracle conectivity
rewati raman
Ranch Hand
Joined: May 22, 2010
Posts: 62
posted
Jul 27, 2010 18:13:19
0
hi I need to write a program to connect to oracle to enter a row into the table.
here is my code.
import java.io.*; import java.sql.*; public class data { public static void main(String[] args) { try { Connection con=null; Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:ORCL", "rew", "happy"); Statement s=con.createStatement(); s.execute("INSERT INTO account VALUES ('soujanya', 'chichula', f,'sj@gmail.com')"); s.close(); con.close(); } catch(Exception e){e.printStackTrace();} } }
i am getting this error.
java data Exception in thread "main" java.lang.NoClassDefFoundError: data Caused by: java.lang.ClassNotFoundException: data at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) Could not find the main class: data. Program will exit.
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
16
I like...
posted
Jul 27, 2010 18:36:47
0
PatienceIsAVirtue
. Do not duplicate threads. Continue the discussion
there
.
[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: java oracle conectivity
Similar Threads
Cant connect to oracle.
Problem with loading driver
Getting an Exception wile accessing data
oracle.jdbc.driver.OracleDriver
Connecting to an Oracle DB
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter