org.hibernate.JDBCException: Error during import script execution at line 2

Hibernate JIRA | Joseph Miller | 8 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    I have in my import.sql the following (which works fine when run directly against the server): declare @today DATETIME; set @today = cast( floor( cast( getdate() as decimal(12,5))) as datetime); (The same error also happens when I use 'select @today = cast( .... )' ) However, when the import.sql is run by Hibernate at startup I get: 12:55:33,099 ERROR [SchemaExport] schema export unsuccessful org.hibernate.JDBCException: Error during import script execution at line 2 at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:332) at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:264) at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:343) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) at sun.reflect.GeneratedMethodAccessor1602.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) .... at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225) Caused by: java.sql.SQLException: Must declare the scalar variable "@today". at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1157) at org.jboss.resource.adapter.jdbc.WrappedStatement.execute(WrappedStatement.java:84) at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:328) ... 105 more

    Hibernate JIRA | 8 years ago | Joseph Miller
    org.hibernate.JDBCException: Error during import script execution at line 2
  2. 0

    I have in my import.sql the following (which works fine when run directly against the server): declare @today DATETIME; set @today = cast( floor( cast( getdate() as decimal(12,5))) as datetime); (The same error also happens when I use 'select @today = cast( .... )' ) However, when the import.sql is run by Hibernate at startup I get: 12:55:33,099 ERROR [SchemaExport] schema export unsuccessful org.hibernate.JDBCException: Error during import script execution at line 2 at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:332) at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:264) at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:343) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103) at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289) at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245) at sun.reflect.GeneratedMethodAccessor1602.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) .... at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225) Caused by: java.sql.SQLException: Must declare the scalar variable "@today". at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631) at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546) at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:723) at net.sourceforge.jtds.jdbc.JtdsStatement.execute(JtdsStatement.java:1157) at org.jboss.resource.adapter.jdbc.WrappedStatement.execute(WrappedStatement.java:84) at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:328) ... 105 more

    Hibernate JIRA | 8 years ago | Joseph Miller
    org.hibernate.JDBCException: Error during import script execution at line 2
  3. 0

    org.hibernate.JDBCException: Error during import script execution – Tuna Töre

    wordpress.com | 10 months ago
    org.hibernate.JDBCException: Error during import script execution at line 1
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ContactListOnOracle | JBoss Developer

    jboss.org | 10 months ago
    org.hibernate.JDBCException: Error during import script execution
  6. 0

    Hibernate – Tuna Töre

    wordpress.com | 10 months ago
    org.hibernate.JDBCException: Error during import script execution at line 1

    Root Cause Analysis

    1. org.hibernate.JDBCException

      Error during import script execution at line 2

      at org.hibernate.tool.hbm2ddl.SchemaExport.importScript()
    2. Hibernate
      SchemaExport.create
      1. org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:332)
      2. org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:264)
      3. org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
      3 frames
    3. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:343)
      1 frame
    4. Hibernate
      AnnotationConfiguration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
      2. org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
      2 frames
    5. Hibernate EJB
      HibernatePersistence.createContainerEntityManagerFactory
      1. org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
      2. org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
      2 frames
    6. org.jboss.ejb3
      PersistenceUnitDeployment.start
      1. org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    8. org.jboss.ejb3
      ServiceDelegateWrapper.startService
      1. org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
      1 frame
    9. JBoss Application Server System
      ServiceMBeanSupport.jbossInternalLifecycle
      1. org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      2. org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      2 frames
    10. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.GeneratedMethodAccessor1602.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2 frames