I am trying to make Scout work with data from initial context. E.g. Getting a string or a datasource. Background is that the final product would be delivered to clients that define their datasource on the application server they are running the application on (most likely that will be websphere). Scout has somehow to find the datasource and use it for the services interacting with the DB.
My problem currently is that I am a bit confused where I am setting the parameters to get from initial context in the Eclipse IDE using Scout. There is a lot of magic going on in the SDK that really confuses me (especially as I am not too familiar with datasources and context)as I am not able to discover where to define context parameters and datasources for the Scout Server (that seems to be somehow included in the SDK and not beeing a separate server I could somehow access). Maybe it is a stupid question, but I am currently stuck at this point.
I am very thankful for the nice replies I received on my othe questions during the last days and hopefully you will be able to help me with this as well.
There not so much magic in the SDK:
* When you create a new scout project an initial template is used.
* The wizards and the views allow you to create java code a little bit quicker than if you had to write it.
Thank you for your reply Jeremie =)
The basic concept of using a Database from within the Scout IDE works perfectly fine for me already. The background of my question regarding the implementation of data sources is the reason that the apllication package should be delivered to a client and the client needs to enter his parameters for accessing an already existing database. The advantage of a datasource would be to get the datasource by openening a handle to a specific name. The server takes care of which datasource is actually behind the name and gives a handle to the application requesting the resource behind the specific name.
The concept of defining data sources in the context is supported bei JEE application servers but as well by tomcat that is used in the deployment tutorial. I would be great if you could manage to ask someone who might know about this topic =)
And what I wanted to say with magic is that it is a bit unclear to me how Scout runs in Eclipse. I was not able to figure out where the server the application is running on is located and how to configure it. As well I did not find a point to influence the resulting web.xml that is included in the exported WAR.
Are there any news on this topic? Is there any way to include a JNDI mapped datasource that is configured in an application server? Or any other way to configure the database after packaging the EAR? What could be helpful as well: Can I somehow influence the web.xml and application.xml that are included when exporting my application as WAR or EAR?
As far as I know, Scout supports access to JNDI data sources. I think the setup should work similar to configuring a direct JDBC connection as described in the tutorials. I'm not able to try this myself at the moment but the following pointers should get you going.
Have a look at AbstractSqlService and its different configuration properties. With getConfiguredDirectJdbcConnection() returning false, you can switch to JNDI data sources (default ist true, which creates direct JDBC connections). Make sure to provide the correct connection details with getConfiguredJndiName() and the different getConfiguredJndi* methods.
Note: Instead of overriding the getConfiguredXXX methods directly in your SqlService, you should probably define the corresponding properties in the servers config.ini file. This way you can set up a JNDI connection for your productive (e.g. deployed) environment, while using a direct JDBC connection in your development environment (when starting the server from Eclipse).
Thank you Lukas =) That helped a lot.
One more thing that would be great: Is there any possible solution I could offer a client after packaging the application to an EAR to define the JNDI-name he wants to use?