Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    multiple db instances without jndi

    Hello,
    I have multiple databases configured in the server.properties using the dbName property and each ds.xml targeting the correct database name.

    However, it seems like SmartGWT is using JNDI as the default mechanism to resolve the dbName property. Anyone knows how to by pass this mechanism and simply load the db config from the server.properties file ?

    Here's a sample of my db config in the property file
    Code:
    sql.fsecure.driver.user: user
    sql.fsecure.driver.url: jdbc:jtds:sqlserver://mywebsite.com/DbName;User=user;Password=passwd
    sql.fsecure.driver.driverName: net.sourceforge.jtds.jdbc.Driver
    sql.fsecure.database.type: sqlserver
    sql.fsecure.driver.password: passwd
    sql.fsecure.autoJoinTransactions: false
    sql.fsecure.interface.credentialsInURL: true
    sql.fsecure.driverName: sqlserver
    sql.fsecure.driver.driverType: thin
    sql.fsecure.driver.networkProtocol: tcp
    sql.fsecure.driver: net.sourceforge.jtds.jdbc.Driver
    sql.fsecure.interface.type: driverManager
    sql.fsecure.driver.serverName: mywebsite
    sql.fsecure.driver.portNumber: 1433
    sql.fsecure.driver.databaseName: databaseName
    sql.fsecure.driver.dbName: databaseName
    sql.fsecure.pool.enabled: true
    sql.fsecure.driver.context: _container_
    and here's a sample of a datasource
    Code:
    <DataSource ID="dbID" serverType="sql" tableName="table"
       dbName="databaseName" requiresAuthentication="true">
    ...
    </DataSource>
    I don't want to use JNDI for many reasons and want to avoid this exception
    Code:
    [INFO] javax.servlet.ServletException: java.sql.SQLException: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
    [INFO] 	at com.isomorphic.sql.SQLConnectionManager.getConnection(SQLConnectionManager.java:159)
    [INFO] 	at com.isomorphic.sql.SQLDriver.implementerClassForDB(SQLDriver.java:222)
    [INFO] 	at com.isomorphic.sql.SQLDriver.instance(SQLDriver.java:184)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.init(SQLDataSource.java:154)
    [INFO] 	at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:134)
    [INFO] 	at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:164)
    thank you,
    Christian

    #2
    This is a convenience feature, and the exception is being logged at INFO level (so it's not a warning or error). You can just set that log category to WARN if you don't that logged.

    Comment

    Working...
    X