Results 1 to 5 of 5

Thread: MySQL rather than HSQL

  1. #1
    Join Date
    Jan 2006
    Posts
    3

    Default MySQL rather than HSQL

    I cant seem to find any classes or the like that indicate how to run the pet clinic example supplied with SRPC to stop using HSQL and use MySQL instead - connector/J was supplied in the lib so presumably its possible?

    any advidce would be great

    Cheers

    Tim

  2. #2
    Join Date
    May 2005
    Posts
    394

    Default

    That's basic spring-dao stuff (see the spring manual).
    It's just a matter of using the *.properties file for mysql instead of hsqldb.
    See the petclinic server/webapp module.

  3. #3
    Join Date
    Jan 2006
    Posts
    3

    Default

    oh yea i see in business-layer-context there is...

    <!-- NB: In-memory HSQL requires recent hsqldb.jar (tested with 1.7.2 RC 6d) -->
    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <value>org.hsqldb.jdbcDriver</value>
    </property>
    <property name="url">
    <value>jdbc:hsqldb:memetclinic</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value></value>
    </property>
    </bean>

    so presumably i could just change the config to inject a mysql db adapter instead?

  4. #4
    Join Date
    May 2005
    Posts
    394

    Default

    yep, see the online spring manual or the book "spring in action" (persistence chapter).

  5. #5
    Join Date
    Jan 2006
    Posts
    3

    Default Still having problems...

    im still having problelms getting the petclinic sample to talk to mysql, i keep getting all sorts of errors...

    Its like the hsql is really tightly bound to the app, i thought they were meant to be easily switchable?! or am i just missing somthing here?

    Can anyone point in the right direction as what i should be changing as i really want to learn this

    Ive changed the xml to...

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <!--<value>org.hsqldb.jdbcDriver</value>-->
    <value>org.gjt.mm.mysql.Driver</value>
    </property>
    <property name="url">
    <!-- <value>jdbc:hsqldb:memetclinic</value> -->
    <value>jdbc:mysql://localhost:3306/petclinic?autoReconnect=true</value>
    </property>
    <property name="username">
    <value>root</value>
    </property>
    <property name="password">
    <value></value>
    </property>
    </bean>

    and ive set up the database in mysql, with all the right tables and data. But i get errors like "Error creating bean with name 'org.springframework.richclient.samples.petclinic. ui.binder.PetTypeBinder"

    Any ideas?!

    Thanks a lot

    Tim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •