How can you connect to a password protected MS Access Database from a Spring JdbcTemplate?
Posted
by Tim Visher
on Stack Overflow
See other posts from Stack Overflow
or by Tim Visher
Published on 2010-04-02T20:18:43Z
Indexed on
2010/04/02
20:53 UTC
Read the original article
Hit count: 282
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?
© Stack Overflow or respective owner