LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 01-24-2013, 04:40 AM   #1
gajananh999
Member
 
Registered: Aug 2012
Posts: 94

Rep: Reputation: Disabled
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver


Dear Everyone,

I m trying to connect to the oracle 11g database using java.

OS: redhat 5.4
64 bit machine

$ uname -a
Linux ip-10-12-195-154 2.6.18-164.0.0.0.1.el5xen #1 SMP Thu Sep 3 00:34:43 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

i have installed ojdbc 6.0

PHP Code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import java.io.RandomAccessFile;
import java.io.File;

import java.sql.Statement;
public class 
showconnect{

//Begin Decleration
        
public final int FAIL = -1;
        public final 
int SUCCESS 0;
        private 
String DSN,UID,PWD,IP,PORT;
        private 
String  path,filedir,name;
        private 
Connection connection;
        private 
Statement statement;
        private 
int id;
//End Decleration

        
public showconnect()
        {
        
//Begin Decleration
                
int len;
                
int j;
                
boolean b false;
        
//End Decleration
                
path "/usr/isac/server/database/";
                
String DSN="SA";
                
String UID ="siteanalytix";
                
String PWD ="siteanalytix";
                
String IP ="localhost";
                
String PORT ="1521";
                
connect();
        }

private 
boolean connect()
        {
                
String driver null;
                
String url null;
 
driver "oracle.jdbc.driver.OracleDriver";
                
url    "jdbc:oracle:thin:@localhost:1521:SA";
                try
                {
                        Class.
forName(driver).newInstance();
                        
connection DriverManager.getConnection(url,UID,PWD);
                        
statement connection.createStatement();
                        
System.out.println("Connected");
                        return 
true;

                }
                catch (
Exception ex)
                {
                        
System.out.println("ISAC Connecting:" +  url " | " UID " | " PWD);
                        
ex.printStackTrace();
                }
                return 
false;
        }

        private 
int disconnect()
        {
                try
                {
                        if(
statement != null)
                                
statement.close();
                        
statement null;
                }
                catch(
Exception e)
                {
                }
                try
                {
                        if(
connection != null)
                                
connection.close();
                        
connection null;
 }
                catch(
Exception e)
                {
                }
                return 
0;
        }
    public static 
void main(String args[]) throws SQLException {


         new 
showconnect();
}



 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
KeepAlive setting and Java Oracle JDBC 51dunk Linux - Networking 0 07-11-2007 04:21 AM
java.lang.ClassNotfoundException Lakshika Linux - Newbie 2 03-31-2006 06:44 AM
Oracle Performance Manager java.lang.UnsatisfiedLinkError stusayre Linux - Software 0 12-14-2004 05:52 PM
oracle jdbc driver for jsdk 1.5 beta? Ikebo Programming 0 10-17-2004 02:13 PM
java.lang.NullPointerException in JDBC test chr15t0 Programming 2 07-07-2003 11:08 AM


All times are GMT -5. The time now is 04:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration