com.ibm.db2.jcc.am.SqlSyntaxErrorException: - java

I am getting below exception:
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet;
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
[jcc][10143][10845][4.19.49] Invalid parameter 1: Parameter is not set nor registered. ERRORCODE=-4461, SQLSTATE=42815 exception.
Hibernate version used - 4.3.10.Final
Spring version used - 4.1.7.RELEASE
DB2 version used - db2jcc4 4.19.49
For fetching the records, we are using HibernateTemplate. Looks like the issue might be because of HibernateTemplate.
Please help on this.

Related

Database connectivity issue in my code

Oracle JDBC Driver Registered!
The connection is established.
The statement object is created.
Exception in thread "main" java.sql.SQLException: ORA-00955: name is already used by an existing object
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1615)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1580)
at conn1.main(conn1.java:17)
I am having no error in the code but still, I'm not able to make a table.
ORA-00955 name is already used by an existing object.
The table name that you are trying to create by using you code also already exists so try with some other name

IO Exception: "/root/test outside /opt/h2/DB

currently I installed the H2 database, but when I the launch the program and I try to access it from my browser (http://localhost:8082/login.do), I get this error:
IO Exception: "/root/test outside /opt/h2/DB" [90028-192] 90028/90028 (Aide) org.h2.jdbc.JdbcSQLException: IO Exception: "/root/test outside /opt/h2/DB" [90028-192]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.engine.ConnectionInfo.setBaseDir(ConnectionInfo.java:182)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:114)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:102)
at org.h2.Driver.connect(Driver.java:72)
at org.h2.server.web.WebServer.getConnection(WebServer.java:735)
at org.h2.server.web.WebApp.login(WebApp.java:955)
at org.h2.server.web.WebApp.process(WebApp.java:211)
at org.h2.server.web.WebApp.processRequest(WebApp.java:170)
at org.h2.server.web.WebThread.process(WebThread.java:133)
at org.h2.server.web.WebThread.run(WebThread.java:89)
at java.lang.Thread.run(Thread.java:745)
How I can fixe this ?
Just add a single "." before the name of your database. For example this is the jdbc url for my database: jdbc:h2:tcp://localhost:9101/~/test and I'll change it to this to work: jdbc:h2:tcp://localhost:9101/~./test. I've read in a forum that this bug relates to H2.
you should change the form jdbc url
and the h2-data which is you start h2 server data path
jdbc:h2:/h2-data/test

Play framework : UnexpectedException: While applying class play.classloading.enhancers.LVEnhancer

I am using for the first time Play framework, on Ubuntu 14, with an existing project. When I try to run the application, I get the following error:
Internal Server Error (500) for request GET /
Oops: UnexpectedException
Unexpected error : While applying play.CorePlugin#44821a96 on models.BookingDTO, caused by exception UnexpectedException: While applying class play.classloading.enhancers.LVEnhancer on models.BookingDTO
play.exceptions.UnexpectedException: While applying play.CorePlugin#44821a96 on models.BookingDTO
at play.plugins.PluginCollection.enhance(PluginCollection.java:582)
at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:242)
at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:164)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:431)
at play.Play.start(Play.java:527)
at play.Play.detectChanges(Play.java:647)
at play.Invoker$Invocation.init(Invoker.java:205)
at Invocation.HTTP Request(Play!)
Caused by: play.exceptions.UnexpectedException: While applying class play.classloading.enhancers.LVEnhancer on models.BookingDTO
at play.CorePlugin.enhance(CorePlugin.java:314)
at play.plugins.PluginCollection.enhance(PluginCollection.java:577)
... 7 more
Caused by: play.exceptions.UnexpectedException: LVEnhancer: cannot enhance the behavior 'models.BookingDTO.findAllNextBookings(java.lang.String)'
at play.classloading.enhancers.LVEnhancer.enhanceThisClass(LVEnhancer.java:112)
at play.CorePlugin.enhance(CorePlugin.java:309)
... 8 more
Caused by: java.lang.NullPointerException
at bytecodeparser.CodeParser.parse(CodeParser.java:53)
at bytecodeparser.analysis.stack.StackAnalyzer.init(StackAnalyzer.java:91)
What's wrong?
Thank you very much for your answer.
I found the solution : I didn't have the version of javassist that didin't match with the project files.
With the Playframework 1.3, javassist-3.20xxx didn't work. I had to install javassist-3.19xxx

Resource governor for 'prepared statements' exceeded

We are using Spring JDBCTemplate 2.5 version and getting below exception when used batchupdate method.
Exception thrown!
org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT SERVICE WHERE CREATE_TIME >= ? AND CREATE_TIME < ?]; SQL state [HY000]; error code [-685]; [Sybase][JDBC Driver][SQL Anywhere]Resource governor for 'prepared statements' exceeded; nested exception is java.sql.SQLException: [Sybase][JDBC Driver][SQL Anywhere]Resource governor for 'prepared statements' exceeded
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:607)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:710)
at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.query(SimpleJdbcTemplate.java:187)
Could you please let me know if it is known issue? if so how to get it resolved.
From the documentation:
Applications that use prepared statements can receive the error "Resource governor for 'prepared statements' exceeded" if the prepared statements are not explicitly dropped once they are no longer required.
So you probably should review your code for non-closed prepared statement or adjust your sybase "max_statement_count" parameter. The later seems more likely as you are using JdbcTemplates

SQLException when running Oracle SQL Stored Procedure in JPA

Running my query in this way
this.entityManager.createNativeQuery("{ ? = call do_build() }").getResultList()
is throwing the exception
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2452)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
at org.hibernate.loader.Loader.list(Loader.java:2187)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1832)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:179)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
... 28 more
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1752)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3444)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
Is there something wrong with my syntax?? I've tried many other forms and haven't been able to find the right format.
-- EDIT --
Stored Procedure:
PROCEDURE do_build AS
version_id NUMBER;
BEGIN
-- selects/truncates/inserts/etc.
END do_build;

Categories