Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Jdbc connectivity by type 4 driver

Ads

 
 

Share on Google+Share on Google+

Akash
Jdbc connectivity by type 4 driver
1 Answer(s)      4 years and 4 months ago
Posted in : JDBC

I have done a code with database connectivity with driver 4,it copiles,but while running it is showing java.lang.ClassNotFound exception..the code is following...

import java.sql.*;
class JdbcDemo1
{
static Connection con=null;
public static void main(String args[])
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521","system","123");
System.out.println("connection established");
Thread.sleep(1000);
Statement stmt=con.createStatement();
String createTable="create table test(name varchar2(20),fname varchar2(20))";
   stmt.executeUpdate(createTable);
System.out.println("Table created successfully");
   Thread.sleep(1000);

   String insertQuery="insert into test values('raja','papa')";
   stmt.executeUpdate(insertQuery);
System.out.println("Records inserted successfully");
Thread.sleep(2000);
System.out.println("Plz,wait....data is fetching...");
Thread.sleep(2000);
ResultSet rs=stmt.executeQuery("select * from test");
while(rs.next())
{
System.out.println("name = "+ rs.getString(1) + "fname = "+ rs.getString(2) );
}
}
catch (Exception e1) 
{ 
e1.printStackTrace(); 
} 
finally 
{ 
        try 
          { 
         con.close(); 
          } 
       catch (Exception e1) 
          {         
e1.printStackTrace();
          }
}
}
}.....end of code

please help me out as soon as possible...i m waiting...and i m using oracle 11g as database.

Ads
View Answers

March 11, 2013 at 6:44 PM


hi friend,

Probably you aren't deploying the oracle driver with your application.


Ads









Related Tutorials/Questions & Answers:
Jdbc connectivity by type 4 driver
Jdbc connectivity by type 4 driver  I have done a code with database connectivity with driver 4,it copiles,but while running it is showing...=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521","system","123
type 4 jdbc driver
type 4 jdbc driver   i read in this site that type 4 jdbc driver is the fastest one so used it to connect with the database.......but not tried another drivers,....can u specifically answer me why type 4 is the fastest one
Advertisements
java- jdbc with type 4 driver
java- jdbc with type 4 driver  My program code is----- import... and Register the JDBC driver:*** DriverManager.registerDriver(new... = DriverManager.getConnection("jdbc:oracle:[email protected]:1521:XE", "system", "oracle"); Statement
Fastest type of JDBC Driver
Fastest type of JDBC Driver  hello, What is the fastest type of JDBC driver?   hii, Type 4 is the fastest JDBC driver
type 4 drivers - JDBC
type 4 drivers  Hi! What is the syntax for Type - 4 drivers. give me any sample code. Thanks in advance..  Hi Friend, Please visit the following link: http://www.roseindia.net/jdbc/jdbc-driver-and-its
fastest type of JDBC driver
fastest type of JDBC driver  What is the fastest type of JDBC driver
Jdbc Driver - JDBC
JDBC Driver Types  Type of JDBC Driver  four..Type 1(JDBC-ODBC Driver)Type 2(java native driver)Type 3Type 4  Type of JDBC... as: * JDBC-ODBC bridge plus ODBC driver, also called Type 1. * Native-API
JDBC CONNECTIVITY
JDBC CONNECTIVITY  How do i connect my database to java. I have the connector file and i place it in lib of jdk folder and installed the jdbc driver... file in environment variable.   Java Mysql connectivity Other JDBC
jdbc driver
jdbc driver  hello, can we create a own jdbc driver? how can we create
no driver - JDBC
{ try { //Loads Type 2 Driver Class.forName...()); System.exit(1); } /* Type 2 driver url */ //String url... the program: run: SQL Exception: No suitable driver found for jdbc:db2
JDBC CONNECTIVITY - JDBC
of JDBC drivers. Each driver has to be register with this class. getConnection...- This is the class where Type 1 Driver is implemented. For more information, visit...JDBC CONNECTIVITY  String jclass="sun.jdbc.odbc.JdbcOdbcDriver
connectivity - JDBC
driver for JDBC and set in the Tomcat/lib folder and if any more problem give full..., Please check the jar file for Connection driver for JDBC and set in the Tomcat... as follows ------------------------------------------------------------------- type
JDBC driver is the fastest one
JDBC driver is the fastest one  Which type of JDBC driver is the fastest one
JDBC Driver - JDBC
JDBC Driver  What are the diffrent types of JDBC driver
database connectivity - JDBC
a user DSN 4. Select Microsoft Access Driver(*.mdb) 5. Select database name... connectivity programs with MSacces   Hi Friend, If you havn't create your.... For programs,visit the following links: http://www.roseindia.net/jdbc/Jdbc-odbc
jdbc connectivity to mysql tutorial
jdbc connectivity to mysql tutorial  here is complete jdbc connectivity to mysql tutorial for newbies. Person who don't even know how to install mysql and don't know about which driver to use can do with ease
JDBC CONNECTIVITY
connectivity Other JDBC Tutorials...JDBC CONNECTIVITY  import java.sql.Connection; import..."); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/abhi
connectivity - JDBC
connectivity  How can we connect sql server using Java   Hi Friend, By using JDBC drivers, you can connect SQL server with java. Please visit the following link: http://www.roseindia.net/jdbc/jdbc.shtml
Best JDBC Driver and Why - JDBC
Best JDBC Driver and Why   Hi Friends , In JDBC 4 drivers are there among this which is best and why. which driver is most commonly used in web application
jdbc connectivity
jdbc connectivity  import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; public class NewJFramefin extends...=e.getActionCommand(); String check; String str="jdbc:odbc:dsn1
JDBC Driver
JDBC Driver  I want to know the clear syntax and usages of $ types of JDBC drivers. Where can i get it? I search for it, nobody give Syntax for tat different drivers. can u give a sample codes for tat
What is JDBC Driver ?
What is JDBC Driver ?  What is JDBC Driver
JDBC Driver interface
JDBC Driver interface  What is JDBC Driver interface
Java JDBC driver
Java JDBC driver  What is JDBC Driver
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver  ... type 1 driver and i have done successfully.but disadvantage is when i create... Sources(ODBC) Open User DSN tab Add a user DSN Select Microsoft Excel Driver
MySQL Driver for JDBC - JDBC
MySQL Driver for JDBC  Sir, I have started reading your JDBC tutorial...... Example."); Connection conn = null; String url = "jdbc:mysql://localhost:3306   Hi,Please download the driver from http://www.mysql.com/products/connector
JDBC Connectivity - JDBC
JDBC Connectivity  my question is how to connect a Java program... String filename = "d:/java/mdbTEST.mdb"; String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; database
JDBC Driver and Its Types
. Type 4 - the Native-Protocol Driver The JDBC type 4 driver, also... for Java JDBC driver is a Type 4 JDBC driver, indicating that the API is a pure... Connectivity (JDBC) driver types. Driver types are used to categorize the technology used
Confused in driver - JDBC
Confused in driver  I am confused about the concept Driver in JDBC. Although i know jdbc very well(in respect... mean to say theoretically it is not cleared please explain me the type of driver... of some picture i want o know
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am...; String url = "jdbc:mysql://localhost:3306/"; String dbName = "jdbctutorial"; String driver = "com.mysql.jdbc.Driver"; String userName
jdbc driver for mysql - Java Beginners
of jdbc-mysql database connectivity and idea about jdbc and mysql driver...jdbc driver for mysql  I need jdbc driver program for connecting java progrma to mysql. Please any one send me the url to download the driver