Announcement Announcement Module
No announcement yet.
Spring Social with jdbc properties Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Social with jdbc properties

    Hi I'm new in spring social, I already download some sample, it really rocks... is there any example in spring social that using local database my sql as datasource, because I really don't have any idea how to, I need some example maybe with file on it like:
    how can I modify spring social showcase so it can use file?
    I'm sorry if this question already asked before/not proper, it just bother me a lot because I don't know what to do..

  • #2
    The way you'd do that is replace the embedded database bean with one that points at a real database. Something like Spring's DriverManagerDataSource, SimpleDriverDataSource, or SingleConnectionDataSource. Then you'd use property placeholders (or the environment if using JavaConfig) to reference the datasource configuration properties from a properties file.

    For example, assuming that you're configuring this in not use the embedded database and instead use:

    <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    <context:property-placeholder location=""/>
    Then, in your file (at the root of the classpath), configure the properties to point at your database.


    • #3
      Also, you'll want to be sure that your database has the UserConnection table defined. It should resemble the table created in

      Be aware, however, that the SQL in that file is not intended to be one-size-fits-all for all databases, so you may need to tweak it a bit to fit whatever kind of database you are using. The key thing is that the table name be the same and the column names be the same...and as much as possible the column types should be the same (although this is where you may need to adjust to suit the types supported by your database).


      • #4
        Thank you for your respond Mr. Walls, it really help, but maybe my problem is in spring social showcase example there is no xml configuration, that what me confuse, but I found that in spring-social-twitter4j use xml configuration, but I really need some project like spring social showcase, maybe I should work this out. Cheers, this project is rocks