Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: type-4 driver with jdbc

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation type-4 driver with jdbc

    file1.jpg


    i have problem in this exception i code exception error
    with type -4


  2. #2
    Junior Member
    Join Date
    Feb 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: type-4 driver with jdbc

    import java.sql.*;
    public class SelectTest

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

    //register driver and establish the connection
    Class.forName("oracle .jdbc.driver.OracleDriver");
    Connection con =DriverManager.getConnection("jdbcracle:thin:@localhost:1521:ORCL.REGRESS.RDMS.DEV.U S.ORACLE.COM","scott","tiger");
    //create statement object
    Statement st =con.createStatement();
    //send and execute query
    ResultSet rs =st.executeQuery("select * from student;");
    // precess the result object
    while(rs.next())
    {
    System.out.println(rs.getInt("sno")+" "+rs.getString("sname")+" " +rs.getString("marks"));
    }
    //close jdbc objects
    rs.close();
    st.close();
    con.close();
    }
    catch (SQLException e)
    {
    e.printStackTrace();
    }



    }//main()

    }//class
    error message above code please find to us

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,237
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: type-4 driver with jdbc

    For future reference, please copy and paste all error message directly to the forums, as well as wrap your code in the code tags.

    Based upon the image, you've got a ClassNotFoundException, in which case you need to add the appropriate Driver of your database to the classpath

  4. #4
    Junior Member
    Join Date
    Feb 2013
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: type-4 driver with jdbc

    Quote Originally Posted by copeg View Post
    For future reference, please copy and paste all error message directly to the forums, as well as wrap your code in the code tags.

    Based upon the image, you've got a ClassNotFoundException, in which case you need to add the appropriate Driver of your database to the classpath
    SQL> select * from global_name;

    GLOBAL_NAME
    ---------------------------------------------
    ORCL.REGRESS.RDBMS.DEV.US.ORACLE.COM

    how to change name global_name to orcl please give answe..

Similar Threads

  1. JDBC Problem - com.mysql.jdbc.Driver
    By icu222much in forum Java Servlet
    Replies: 2
    Last Post: November 21st, 2011, 10:54 PM
  2. java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    By i4ba1 in forum JDBC & Databases
    Replies: 2
    Last Post: August 23rd, 2011, 12:41 PM
  3. setting JDBC driver steps
    By planmaster in forum JDBC & Databases
    Replies: 1
    Last Post: November 6th, 2010, 02:02 PM
  4. How to instal JDBC driver package in eclipse
    By sathish in forum JDBC & Databases
    Replies: 2
    Last Post: September 2nd, 2010, 10:09 AM
  5. How to install a JDBC driver in Eclipse? And where to take it from?
    By noFear in forum Java Theory & Questions
    Replies: 2
    Last Post: August 17th, 2010, 10:51 AM