Share on Google+Share on Google+

Akash
Jdbc connectivity by type 4 driver
1 Answer(s)      4 years and a month 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.










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:thin@localhost: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
fastest type of JDBC driver
fastest type of JDBC driver  What is the fastest type of 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
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 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 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
JDBC Driver  What are the diffrent types of JDBC driver
JDBC driver is the fastest one
JDBC driver is the fastest one  Which type of JDBC driver is the fastest one
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
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 interface
JDBC Driver interface  What is JDBC Driver interface
What is JDBC Driver ?
What is JDBC Driver ?  What is JDBC 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
Java JDBC driver
Java JDBC driver  What is JDBC Driver
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
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
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
JDBC CONNECTIVITY
connectivity Other JDBC Tutorials...JDBC CONNECTIVITY  import java.sql.Connection; import..."); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/abhi
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
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
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
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
Set properties for a JDBC driver
Set properties for a JDBC driver  How do I set properties for a JDBC driver and where are the properties stored
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 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
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
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
Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads