Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29693

Audit2DB: error code [1046]; No database selected; nested exception is java.sql.SQLException: No database selected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • audit2db-plugin
    • None
    • Jenkins v1.622
      Audit to Database Plugin v0.5
      MySQL JDBC Driver: mysql-connector-java-5.1.36-bin.jar
      CentOS 7

      Tried to use the plugin with MYSQL.
      Created the db on localhost mysql named "audit2DB"

      in global configuration: I have the following for the audit2db configuration:

      JDBC Driver class: com.mysql.jdbc.Driver
      JDBC Url: jdbc:mysql://127.0.0.1:3306/audit2db
      User: root
      Password: <NULL>

      I can Test the connection successful.
      I used the script window to generate the DDL file and run it against my db "audit2db"

      Now, after saving the config and add "audit to db" post build step, and run the build, I got the following error:

      Not sure why it says DB is not selected.

      ======================================================
      ERROR: Build step failed with exception
      org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not load an entity: org.jenkins.plugins.audit2db.internal.model.BuildDetailsImpl#localhost.localdomain/computer/(master)//test/7; uncategorized SQLException for SQL [select builddetai0_.id as id78_1_, builddetai0_.duration as duration78_1_, builddetai0_.endDate as endDate78_1_, builddetai0_.fullName as fullName78_1_, builddetai0_.name as name78_1_, builddetai0_.node_url as node10_78_1_, builddetai0_.result as result78_1_, builddetai0_.startDate as startDate78_1_, builddetai0_.userId as userId78_1_, builddetai0_.userName as userName78_1_, buildnodei1_.url as url80_0_, buildnodei1_.description as descript2_80_0_, buildnodei1_.displayName as displayN3_80_0_, buildnodei1_.label as label80_0_, buildnodei1_.masterAddress as masterAd5_80_0_, buildnodei1_.masterHostName as masterHo6_80_0_, buildnodei1_.name as name80_0_ from JENKINS_BUILD_DETAILS builddetai0_ left outer join JENKINS_BUILD_NODE buildnodei1_ on builddetai0_.node_url=buildnodei1_.url where builddetai0_.id=?]; SQL state [3D000]; error code [1046]; No database selected; nested exception is java.sql.SQLException: No database selected
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
      at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
      at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
      at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
      at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:512)
      at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:506)
      at org.jenkins.plugins.audit2db.internal.data.BuildDetailsHibernateRepository.getBuildDetailsById(BuildDetailsHibernateRepository.java:121)
      at org.jenkins.plugins.audit2db.internal.data.BuildDetailsHibernateRepository.getBuildDetailsForBuild(BuildDetailsHibernateRepository.java:307)
      at org.jenkins.plugins.audit2db.internal.DbAuditPublisherImpl.perform(DbAuditPublisherImpl.java:108)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
      at hudson.model.Build$BuildExecution.cleanUp(Build.java:195)
      at hudson.model.Run.execute(Run.java:1788)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:381)
      Caused by: java.sql.SQLException: No database selected
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2447)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2594)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1901)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2002)
      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.loadEntity(Loader.java:1953)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:997)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:990)
      at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:519)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
      ... 14 more
      Build step 'Audit job info to Database' marked build as failure
      Finished: FAILURE

            mscata Marco Scata
            kevcheng Kevin Cheng
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: