This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Spring and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException:" Watch "Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException:" New topic
Author

Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException:

Keerthi Kumar
Ranch Hand

Joined: Apr 20, 2009
Posts: 105
Hi,

I am working on one spring jdbc application and i am getting the following error:

Aug 26, 2009 11:18:03 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [movies.xml]
Aug 26, 2009 11:18:03 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: sun.jdbc.odbc.JdbcOdbcDriver
Aug 26, 2009 11:18:03 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
Aug 26, 2009 11:18:03 AM org.springframework.jdbc.support.SQLErrorCodesFactory <init>
INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [insert into movies_tbl(id,title,price,lang) values (?,?,?,?)]; SQL state [S1000]; error code [0]; General error; nested exception is java.sql.SQLException: General error
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:582)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:767)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:825)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:829)
at com.SpringJdbcDemo.MoviesDAOImpl.addMovies(MoviesDAOImpl.java:16)
at com.SpringJdbcDemo.MoviesClient.main(MoviesClient.java:33)
Caused by: java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(Unknown Source)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:773)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:566)
... 5 more


Please can help me out in this.

Thanks,
Keerthi Kumar N


Cheers,
Keerthi Kumar N
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Try to run the SQL on DBMS.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Keerthi Kumar
Ranch Hand

Joined: Apr 20, 2009
Posts: 105
Hi,

I have checked the query in toad and its working perfect!

Please help me out in this!

Thanks,
Keerthi Kumar N
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
It's a SQLException, the problem is because of SQL statement. Please recheck.
Keerthi Kumar
Ranch Hand

Joined: Apr 20, 2009
Posts: 105
Hi,

Please find my xml file below. Let me know if the error is caused due to this xml.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</property>
<property name="url">
<value>jdbcdbc:movies</value>
</property>

</bean>
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg>
<ref bean="datasource" />
</constructor-arg>
</bean>


<bean id="movies" class="com.SpringJdbcDemo.MoviesDAOImpl">
<property name="jdbcTemplate">
<ref bean="jdbcTemplate" />
</property>

</bean>


</beans>

 
Don't get me started about those stupid light bulbs.
 
subject: Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: