-
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
-
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.
-
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:mem:petclinic</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?
-
yep, see the online spring manual or the book "spring in action" (persistence chapter).
-
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:mem:petclinic</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