views:

158

answers:

0

I need to connect to a password protected MS Access 2003 DB using the JDBC-ODBC bridge. I can't find out how to specify the password in the connect string, or even if that is the correct method of connecting.

It would probably be relevant to mention that this is a Spring App which is accessing the database through a JdbcTemplate configured as a datasource bean in our application context file.

Some relevant snippets:

from application-context.xml

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="legacyDataSource" />
</bean>

<bean id="jobsheetLocation" class="java.lang.String">
    <constructor-arg value="${jobsheet.location}"/>
</bean>

<bean id="legacyDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${jdbc.legacy.driverClassName}" />
    <property name="url" value="${jdbc.legacy.url}"/>
    <property name="password" value="-------------" />
</bean>

from our build properties

jdbc.legacy.driverClassName=sun.jdbc.odbc.JdbcOdbcDriver
jdbc.legacy.url=jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)};Dbq\=@LegacyDbPath@;DriverID\=22;READONLY\=true

Any thoughts?