java - Getting exception in JDBC thin driver -
i try run query using java , below mentioned program
import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; import javax.naming.spi.dirstatefactory.result; public class oracleconn { public static void main(string[] args) { try { class.forname("oracle.jdbc.driver.oracledriver"); connection con = drivermanager.getconnection("jdbc:oracle:thin:@localhost:1521:yglobal","user","user"); statement stmt = con.createstatement(); resultset rs = stmt.executequery("select empid empmaster"); while(rs.next()) system.out.println(rs.getint(1)); con.close(); } catch (exception e) { e.printstacktrace(); }} }
but when tried run program getting exception
java.sql.sqlexception: ora-01756: quoted string not terminated @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:112) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:331) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:288) @ oracle.jdbc.driver.t4c8oall.receive(t4c8oall.java:743) @ oracle.jdbc.driver.t4cstatement.dooall8(t4cstatement.java:207) @ oracle.jdbc.driver.t4cstatement.executefordescribe(t4cstatement.java:790) @ oracle.jdbc.driver.oraclestatement.executemaybedescribe(oraclestatement.java:1038) @ oracle.jdbc.driver.t4cstatement.executemaybedescribe(t4cstatement.java:830) @ oracle.jdbc.driver.oraclestatement.doexecutewithtimeout(oraclestatement.java:1133) @ oracle.jdbc.driver.oraclestatement.executequery(oraclestatement.java:1273) @ jdbc.oracleconn.main(oracleconn.java:28)
Comments
Post a Comment