Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] JNDI from properties file.

Hi guys,

I have this question. I have configured my database datasource with jndi in jetty.xml, like this:

    <New id="dataSource" class="org.eclipse.jetty.plus.jndi.Resource">
        <Arg></Arg>
        <Arg>jdbc/myDS</Arg>
        <Arg>
            <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
                <Set name="driverClass">
                    <SystemProperty name="jdbc.driverClassName" default="com.mysql.jdbc.Driver"/>
                </Set>
                <Set name="jdbcUrl">
                    <SystemProperty name="jdbc.url"
                                    default="jdbc:mysql://localhost:3306/mydb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8&amp;connectionCollation=utf8_general_ci&amp;characterSetResults=utf8"/>
                </Set>
                <Set name="user">
                    <SystemProperty name="jdbc.username" default="root"/>
                </Set>
                <Set name="password">
                    <SystemProperty name="jdbc.password" default="admin"/>
                </Set>
                <Set name="minPoolSize">5</Set>
                <Set name="maxPoolSize">50</Set>
                <Set name="acquireIncrement">3</Set>
                <Set name="acquireRetryAttempts">0</Set>
                <Set name="acquireRetryDelay">3000</Set>
                <Set name="breakAfterAcquireFailure">false</Set>
                <Set name="maxConnectionAge">60</Set>
                <Set name="maxIdleTime">30</Set>
                <Set name="maxIdleTimeExcessConnections">10</Set>
                <Set name="idleConnectionTestPeriod">15</Set>
                <Set name="testConnectionOnCheckout">true</Set>
                <Set name="preferredTestQuery">SELECT 1</Set>
                <Set name="debugUnreturnedConnectionStackTraces">true</Set>
                <Set name="autoCommitOnClose">true</Set>
            </New>
        </Arg>
    </New>

Now I would like to replace the username/password and the url with values from properties file. I tried with SystemProperties but it doesn't work + I don't want to specify them as system properties. I have a file called system.properties in my classpath and I would like to use the properties from it. Is that possible?


--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Back to the top