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
Post a Comment