ERROR while connecting JDBC -


import java.sql.*; public class jdbcdemo {      /**      * @param args      */     public static void main(string[] args) {         // todo auto-generated method stub          try {             class.forname("oracle.jdbc.driver.oracledriver");             connection c=drivermanager.getconnection("jdbc.oracle:thin:@hp-hp:1521:xe","system", "ashu41228");             if(c!=null)             {                 system.out.println("database created");               }           } catch (classnotfoundexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (sqlexception e) {             // todo auto-generated catch block             e.printstacktrace();         }      }  } 

java.sql.sqlexception: no suitable driver found jdbc.oracle:thin:@hp-hp:1521:xe @ java.sql.drivermanager.getconnection(unknown source) @ java.sql.drivermanager.getconnection(unknown source) @ jdbcdemo.main(jdbcdemo.java:12)

the above exception coming dont know how tackle this.pls help

according stacktrace,

java.sql.sqlexception: no suitable driver found

it looks don't have suitable driver oracle database. solve problem, you'll have have oracle jdbc driver in classpath.

you can download suitable driver oracle site , add package build path.

refer this article set classpath or other questions.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -