Bhoopesh Tyagi
JDBC Oracle program
1 Answer(s)      4 years and a month ago
Posted in : JDBC

Here is my code:

import java.sql.*;
public class Tyagi
    public static void main (String args[])throws SQLException
        ResultSet rs;
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:8080:oracle", "System", "System");
        Statement st = conn.createStatement();
        rs=st.executeQuery("Select * from brendon");
        catch(Exception e)

i have found exception in the code that is java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

View Answers

May 25, 2013 at 12:31 AM

use this code

import java.sql.Connection;

import java.sql.Statement;

import java.sql.ResultSet;

import java.sql.DriverManager;

public class DemoForYou


public static void main(String[] args) throws Exception


//Establish the connection between java application and 
database software


//Register Driver with DriverManager service

Connection con=DriverManager.getConnection("jdbc:odbc:give your dsn","username","password");

//Send and execute query in database s/w

Statement st=con.createStatement();

//process the result

ResultSet rs=st.executeQuery("select * from stduent");


System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));

//close the jdbc objects






query of the application

SQL>create table student(sid number,sname varchar2(20),sadd varchar2(20));

table created

SQL> insert into student values(101,jack,hyderabad);
1 row updated

here 101=getInt(1)



Related Tutorials/Questions & Answers:
JDBC Oracle program
JDBC Oracle program  Here is my code: import java.sql.*; public class Tyagi { public static void main (String args[])throws SQLException... = DriverManager.getConnection("jdbc:oracle:thin:@localhost:8080:oracle", "System", "System
oracle - JDBC
oracle  sir iam hari iam doing the project using oracle with jdbc in xp when iam inserting the data it is giving error like ora-01034:oracle not available sir plz.......give me the solution it is urgent sir thanku
Oracle - JDBC
Oracle fetch variables  i wanted to fetch variables from database using Oracle
jdbc-oracle - JDBC
jdbc-oracle  Hi! sub: image insertion in oracle: I inserted the image in oracle database using java through jdbc-odbc bridge driver... though my java program compiles and runs without any error. Pl. answer
oracle - JDBC
to store these two fields into oracle database for that i have given one jsp page... it is giving error like java.sql.SQLException:[MICROSOFT][ODBC Driver for oracle][oracle
oracle - JDBC
oracle  How to collect the backup of tables in oracle? plz,, i want some tables in oracle of one system to be shifted to the another system...;There are two .exe files in ORACLE, with the FOLLOWING names,generally
oracle - JDBC
oracle  HI i am using ORACLE 10g. How to i find "TNSNAMES.ORA" file in my system after installation of ORACLE 10g succussfully. please send... that depends on the actual network implementation used. Oracle recommends that SDU
Oracle - JDBC
Oracle  How to Use Blob and Clob Data types in Oracle...  Hi friend BLOB : Binary Large Object CLOB : Character Large Object Default storage each time a BLOB or CLOB exceeds 4000 bytes you could cause
Oracle ANd JDBC - JDBC
Oracle ANd JDBC  How to Save and Retrieve an Image or File into a Oracle Table.. Please give me answer as early as possible.. Thanks
servlets+jdbc+oracle - JDBC
servlets+jdbc+oracle  can you please help me to create a dynamic website. can you send me source code for creating a dynamic website for an engneering college
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
conncetion with oracle throuth jdbc - JDBC
conncetion with oracle throuth jdbc  i use jdk1.5 when i compile our JDBC java pro. with ojdbc14.jar file it give no error. but when i run that class it give error of unsupported class version. which jar file use for compile
error occured in oracle - JDBC
error occured in oracle  hi... this is the error i got in oracle 11g when i am trying to insert image ORA-00984:column not allowedd here...: Hope that it will be helpful
java to oracle code - JDBC
java to oracle code  please suggest m calculate the database performance between scaled images and unscaled images in the database
Oracle Database error - JDBC
Oracle Database error   String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid; ResultSet rs11... = DriverManager.getConnection("jdbc:mysql://localhost:3306/register", "root", "root"); Statement
Java vs Oracle Connectivity - JDBC
Java vs Oracle Connectivity  Write a java program to establish... = DriverManager.getConnection("jdbc:oracle:oci8:", "root", "root"); where... = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:3306:roseindia", "root", "root
Could not establish the connection to oracle - JDBC
=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","puppy"); please help... to use: Connection conn = DriverManager.getConnection("jdbc:oracle:oci8... to use: Connection conn = DriverManager.getConnection ("jdbc:oracle:thin
jsp-oracle validation - JDBC
jsp-oracle validation  Dear friends, my validation not takes place. can you please tell me where the code is wrong, because sometimes it validates.... --------------------------------------- logoutaction.jsp --------------------------------------- oracle 10g
servlet program for data store in oracle?
servlet program for data store in oracle?  how to store data in oracle through servlet program
java connecting to oracle db - JDBC
to use: Connection conn = DriverManager.getConnection("jdbc:oracle:oci8... have to use: Connection conn = DriverManager.getConnection ("jdbc:oracle:thin...()); Connection conn = DriverManager.getConnection("jdbc:oracle:thin: @localhost
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
oracle insert statement error - JDBC
oracle insert statement error  hi.. please help me to insert a image into oracle 11g database and please say me how can i insert image from directory like G:\imagefolder\ultrasoundimage\02us02.jpeg please help me
jdbc program
jdbc program   Write a program to update the salaryRs.6000/- for an employee name like ‚??P. Ramu‚?? using prepared statement
Java Barcode Program with Oracle database
Java Barcode Program with Oracle database  Hi Everyone, I need help to develop my new project, am going to do with barcode s/w, am very new... no and serial no of the item being scanned to Oracle 10g database. I dont have any
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect to Oracle are contained in the Oracle JDBC driver jar file. For recent releases
Jdbc and Socket Program - JDBC
Jdbc and Socket Program  Sir, I would like to get a program i... in a database.Now we create another program 4 client-server such that the sever's database is updated everytime we enter username and password in client program
jdbc connection to java program code - JDBC
jdbc connection to java program code  i want a simple java program that which communicates with oracle database like creating table,insert values and update records in database and show in program output? please take a simple
Jdbc connectivity in java to oracle for retrieving data between two dates
Jdbc connectivity in java to oracle for retrieving data between two dates  Dear Sir, I Need a program in which i want to retrieve the data b/w two... am using the oracle. please help. thankyou sir
execution of a jdbc program
execution of a jdbc program  how to execute a servlet program that..uses a jdbc driver (i.e. using mysql-connector -java )to connect to mysql in windows *PLS provid the execution steps in detail THANK YOU
java program - JDBC
of tables as fields, in this case i have three tables, i need a java program..., Please give details to solve the problem. For read JDBC connection to visit....
store the image in the oracle using blob and get it back - JDBC
("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin...(); } } --------------------------------------- In this program using jdbc the image in the oracle using blob and get it back  hi i am