java - unable to connect spring with mysql -


i working on spring hello samples spring documentation. in connecting embedded database, instead trying configure mysql database. samples git https://github.com/spring-guides/gs-batch-processing.git

kindly guide me steps.

adding jdbc-driver pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelversion>4.0.0</modelversion>      <groupid>org.springframework</groupid>     <artifactid>gs-batch-processing</artifactid>     <version>0.1.0</version>      <parent>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-parent</artifactid>         <version>1.2.2.release</version>     </parent>     <dependencies>         <dependency>             <groupid>org.springframework.boot</groupid>             <artifactid>spring-boot-starter-batch</artifactid>         </dependency>          <dependency>         <groupid>org.springframework</groupid>         <artifactid>spring-jdbc</artifactid>         <version>4.1.6.release</version>         </dependency>           <dependency>                 <groupid>mysql</groupid>                 <artifactid>mysql-connector-java</artifactid>                 <version>5.1.34</version>         </dependency>          <dependency>         <groupid>javax.batch</groupid>         <artifactid>javax.batch-api</artifactid>         <version>1.0.1-b01</version>         </dependency>     </dependencies>        <build>         <plugins>             <plugin>                 <groupid>org.springframework.boot</groupid>                 <artifactid>spring-boot-maven-plugin</artifactid>             </plugin>         </plugins>     </build>  </project> 

here database configuration file

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">      <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">         <property name="driverclassname" value="com.mysql.jdbc.driver" />         <property name="url" value="jdbc:mysql://localhost:3306/spring" />         <property name="username" value="root" />         <property name="password" value="" />     </bean>  </beans> 

am missing here? still connecting embedded hsql db. see following,

  .   ____          _            __ _ _  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )   '  |____| .__|_| |_|_| |_\__, | / / / /  =========|_|==============|___/=/_/_/_/  :: spring boot ::        (v1.2.2.release)  2015-04-01 18:10:41.746  info 10234 --- [           main] hello.application                        : starting application v0.1.0 on alaska pid 10234 (/home/malarvizhi/a/spring/bs2/target/gs-batch-processing-0.1.0.jar started malarvizhi in /home/malarvizhi/a/spring/bs2) 2015-04-01 18:10:41.822  info 10234 --- [           main] s.c.a.annotationconfigapplicationcontext : refreshing org.springframework.context.annotation.annotationconfigapplicationcontext@9c7bcc0: startup date [wed apr 01 18:10:41 ist 2015]; root of context hierarchy 2015-04-01 18:10:42.961  warn 10234 --- [           main] o.s.c.a.configurationclassenhancer       : @bean method scopeconfiguration.stepscope non-static , returns object assignable spring's beanfactorypostprocessor interface. result in failure process annotations such @autowired, @resource , @postconstruct within method's declaring @configuration class. add 'static' modifier method avoid these container lifecycle issues; see @bean javadoc complete details 2015-04-01 18:10:42.975  warn 10234 --- [           main] o.s.c.a.configurationclassenhancer       : @bean method scopeconfiguration.jobscope non-static , returns object assignable spring's beanfactorypostprocessor interface. result in failure process annotations such @autowired, @resource , @postconstruct within method's declaring @configuration class. add 'static' modifier method avoid these container lifecycle issues; see @bean javadoc complete details 2015-04-01 18:10:43.253  info 10234 --- [           main] o.s.j.d.e.embeddeddatabasefactory        : creating embedded database 'testdb' 2015-04-01 18:10:43.764  info 10234 --- [           main] o.s.jdbc.datasource.init.scriptutils     : executing sql script url [jar:file:/home/malarvizhi/a/spring/bs2/target/gs-batch-processing-0.1.0.jar!/schema-all.sql] 2015-04-01 18:10:43.769  info 10234 --- [           main] o.s.jdbc.datasource.init.scriptutils     : executed sql script url [jar:file:/home/malarvizhi/a/spring/bs2/target/gs-batch-processing-0.1.0.jar!/schema-all.sql] in 5 ms. 2015-04-01 18:10:44.269  info 10234 --- [           main] o.s.jdbc.datasource.init.scriptutils     : executing sql script class path resource [org/springframework/batch/core/schema-hsqldb.sql] 2015-04-01 18:10:44.279  info 10234 --- [           main] o.s.jdbc.datasource.init.scriptutils     : executed sql script class path resource [org/springframework/batch/core/schema-hsqldb.sql] in 9 ms. 2015-04-01 18:10:44.460  info 10234 --- [           main] o.s.j.e.a.annotationmbeanexporter        : registering beans jmx exposure on startup 2015-04-01 18:10:44.479  info 10234 --- [           main] o.s.b.a.b.joblaunchercommandlinerunner   : running default command line with: [] 2015-04-01 18:10:44.492  info 10234 --- [           main] o.s.b.c.r.s.jobrepositoryfactorybean     : no database type set, using meta data indicating: hsql 2015-04-01 18:10:44.628  info 10234 --- [           main] o.s.b.c.l.support.simplejoblauncher      : no taskexecutor has been set, defaulting synchronous executor. 2015-04-01 18:10:44.694  info 10234 --- [           main] o.s.b.c.l.support.simplejoblauncher      : job: [flowjob: [name=importuserjob]] launched following parameters: [{run.id=1}] 2015-04-01 18:10:44.720  info 10234 --- [           main] o.s.batch.core.job.simplestephandler     : executing step: [step1] converting (firstname:  

try one. using following properties connect mysql. can see properties have used might work postgresql.

<bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">         <property name="driverclass" value="com.mysql.jdbc.driver" />         <property name="jdbcurl" value="jdbc:mysql://localhost:3306/spring" />         <property name="username" value="root" />         <property name="password" value="" />     </bean> 

let me know if not work.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -