oracle - Glassfish 3 Connection Pool throws java.sql.SQLSyntaxErrorException: ORA-00933 -
iam using glassfish 3 server run web service. connection pool implemented in server , able ping database.
connection received server throwing java.sql.sqlsyntaxerrorexception: ora-00933: sql command not ended
exception while running preparedstatement.
glassfish 4 not throw exception
the query taken property file
query=select * table systemid=?1
using 2 seperate java classes receiving connection , further processing
jdbcutil.java
public static connection connectionfromconnectionpool() throws namingexception, sqlexception { context initctx = new initialcontext(); datasource datasource = (datasource) initctx.lookup(propertyfilereader .getpropertyvalue("connectionpool.jndi.name")); connection connection = (connection) datasource.getconnection(); if (connection != null) { logger.info("received connection"); } else { logger.info("no connection received"); } return connection; }
dao.java
resultset resultset = null; preparedstatement preparedstatement = null; connection connection = null; try { connection = jdbcutil.connectionfromconnectionpool(); if (connection != null) { preparedstatement = connection .preparestatement(propertyfilereader .getpropertyvalue("query")); if (preparedstatement != null) { preparedstatement.setstring(1, "systemid"); resultset = preparedstatement.executequery(); // line no:56
log generated :
18:13:35,328 info - *****.jdbcutil.connectionfromconnectionpool(jdbcutil.java:38) - received connection 18:13:35,397error - *****(dao.java:81) - **************************** :: java.sql.sqlsyntaxerrorexception: ora-00933: sql command not ended @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:440) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:396) @ oracle.jdbc.driver.t4c8oall.processerror(t4c8oall.java:837) @ oracle.jdbc.driver.t4cttifun.receive(t4cttifun.java:445) @ oracle.jdbc.driver.t4cttifun.dorpc(t4cttifun.java:191) @ oracle.jdbc.driver.t4c8oall.dooall(t4c8oall.java:523) @ oracle.jdbc.driver.t4cpreparedstatement.dooall8(t4cpreparedstatement.java:207) @ oracle.jdbc.driver.t4cpreparedstatement.executefordescribe(t4cpreparedstatement.java:863) @ oracle.jdbc.driver.oraclestatement.executemaybedescribe(oraclestatement.java:1153) @ oracle.jdbc.driver.oraclestatement.doexecutewithtimeout(oraclestatement.java:1275) @ oracle.jdbc.driver.oraclepreparedstatement.executeinternal(oraclepreparedstatement.java:3576) @ oracle.jdbc.driver.oraclepreparedstatement.executequery(oraclepreparedstatement.java:3620) @ oracle.jdbc.driver.oraclepreparedstatementwrapper.executequery(oraclepreparedstatementwrapper.java:1491) @ com.sun.gjc.spi.jdbc40.preparedstatementwrapper40.executequery(preparedstatementwrapper40.java:642) @ *************************************(dao.java:56) ....................
ojdbc6.jar placed in glassfish3\glassfish\lib , glassfish4\glassfish\lib
check if there other ojdbc jar inside server folder inside domain folder using.
if there different jars or different versions of jar in server folder, may cause such errors.
for ex : glassfish3\glassfish\domains\domain1\lib...
if there jar files of different versions, replace them same version.
i use glassfish4. kept ojdbc jar in glassfish4\glassfish\lib works fine me.
Comments
Post a Comment