How use existing connection in Logic Apps Designer - azure-logic-apps

When I create a new Logic App and choose, for example, "SFTP file is added or modified" I am prompted to add the connection information. I have already created an API connection to my SFTP server. How to choose this existing connection instead of creating a new one in Designer? Or do I have to switch to Code View in order to use an existing connection?
Update: I tried in code view to copy over my connections ( the "$connections" element from another Logic App) and go this error:
Operation failed: The template validation failed: 'The template parameters '$connections' are not valid; they are not present in the original template and can therefore not be provided at execution time. The only supported parameters for this template are ''.'.

The answer is that the new Logic App has to be in the same region as the existing API Connection.

Related

Mirth- Database writer error

I am trying to create a channel to write to a database from HTTP source.
I have made two destinations both to same database. One destination writes via JavaScript and the other with SQL.
The data gets written to database in the first destination(the JavaScript one) but not through the second(SQL). I am not able to get the tables through "Insert" button also. It gives the following error:
Someone please give me the solution to set up database connection without any flaw. Please note that the database is secured one in AWS instance.
To connect to database via javascript, you will need to select "Yes" under the option to use javascript. Then your connector will look something like this:
var dbConn;
try {
dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','ServerURL','Username','Password');
// You may access this result below with $('column_name')
return result;
} finally {
if (dbConn) {
dbConn.close();
}
}
Note that you can click on the "generate" button and this template will be created for you in the javascript window.
Based on the information you have given, I am not sure that your method/syntax is the cause to your error. Can you verify that your database driver jar file is located in your installation? (Mine is located at "...\Mirth Connect\server-lib\database"

Stop Grails from opening a connection to the database in a Controller method

I have a service that is communicating to another machine. Since it's a simple Controller method Grails automatically grabs a DB connection from the pool while my controller is communicating with the other server. I'd like to prevent it from doing that, and manually open up the database connection when I'm ready so that it doesn't suck up a connection during a long period like doing network calls. How do I prevent Grails from automatically grabbing a connection from the pool in a controller method?
When you create a controller it has the Transactional annotation on it, something like:
#Transactional(readOnly=true)
class FooController { ..
If you remove that annotation (and any method level annotations) then Grails will no longer connect to the database to start the transaction.
Open Session In View should not come into play since we use a lazy init approach for obtaining the connection with OSIV
Note my answer above assumes you are using a recent version of Grails (2.3.x or above)
Updated
For MongoDB you can disable automatically connection for all controllers by defining the following bean (which overrides the default) in grails-app/conf/spring/resources.groovy:
mongoPersistenceInterceptor(org.codehaus.groovy.grails.support.NullPersistentCon‌​textInterceptor)
However there is no way to disable on a per controller basis at the moment

How to force the Entity Framework 5 DbContext to re-read connection strings from app.config?

I am trying to allow users to type in the data source into a dialog which I am then writing to the app.config for the application. The scenario I am having a problem with works like this:
1) User types the data source into my dialog and the dialog adds or updates the connection string. In this scenario the user typed the wrong data source the first time.
2) The user then opens the dialog that has the EF code (which inits the connection string stuff) and EF throws an exception that it cannot connect.
3) The user goes back into the original dialog and puts the correct data source name in and the app.config is again updated.
4) The user the opens again the dialog that triggers the EF code and EF still has the old data source in there although it is correct now in the app.config.
I have tried
ConfigurationManager.RefreshSection("connectionStrings").
I have tried running
MyEFContainer.Database.Initialize() as well.
Neither seems to work. What do I need to do to have EF refresh the connection string data without forcing the user to close and reopen the app? If they do that then it works.
I would always work with a connection string in memory. Keep it e.g. in a context factory. Initially you read it from the config file, but it may get replaced by a new one. You store the new one in the app.config (when it is valid) for the next run of the application.
Are you instantiating a new instance of the DbContext class after the connection string is corrected? Reusing the DbContext instance that initially failed would be the problem.
For the moment,I think to force EF to reload app.config .After we change the app.config the
ConfigurationManager.RefreshSection("xxx")
is not worked for EF,so you must to restart your application.
The best way to solve the problem:
with NO Connection strings in app.config.
Uses automatic migrations and 2 databases using the same context. The real runtime supplied Connection. Approach.

How to create web service using Database adapter in OSB Console?

I have a requirement to use OSB with DB Adapter as for given task, I believe BPEL Process will not be better performer than OSB. I have gone through some sites but all of them are demonstrating OEPE not OSB Console. Any response will be appreciated.
I have similar requirement in my project and I was wondering here and there. Here is final solution of the problem. I documented for you guys.
Steps in JDeveloper
1. Create DB Connection in JDeveloper.
2. Create a Generic Project.
3. Create Project as SOA project and use Empty Composite.
Steps to create DB Adaptor
Go to Composite Palette and choose AD Adaptor.
Drag and drop the DB Adaptor in the External Reference section (right side of Composite view).
It will open a wizard for selecting the connection and Other DB related process.
Give name to service that you want to create
Choose the DB Connection you have created already.
Move one with selecting your desired choice of Stored Procedure or Table (insert/Select) functionality that you want your web service to perform.
If you choose Table insert/Select then you can also choose the relation between tables as optional step.
Try to keep all steps default if you do not want any special features.
Once you finish all steps in wizard, then it will generate whole lot of files under your Project.
Look for 4 main files .jca, xsd/.xsd, *.mapping.xml, *.wsdl
If you see all these files generated well in your project then you are all set and we can move ahead. If not then look for the issue.
Steps in WLS Console
Create Data Source
1.Go to Left panel and choose Data Source.
2. Select New -- Generic Data Source
3. Give Name as you wish but for JNDI Name you have to use the connection name from the *.JCA file that you already have. Open the jca file and search for the ‘UIConnectionName’. This value will be used as JNDI name in data source creation.
4. Choose Driver as oracle.jdbc.xa.client.OracleXADataSource
5. Use the host and Port and other details that you had selected during DB Connection (in JDeveloper). This is obvious step.
6. Choose target AdminServer.
7. If you finish everything correctly. You are all set here and you can choose to test the connection and should be Test Success.
Configure the DB Adaptor
Go to Deployment on left hand panel.
In Deployed services. Search for DbAdaptor.
Click on the name DbAdaptor.
Select Configuration tab. And under it choose Outbound Connection Pool.
Here you will see (javax.resource.cci.ConnectionFactory)
Click on new.
Choose javax.resource.cci.ConnectionFactory
Next page will ask for JNDI Name. For this, you have to go to your *.jca file and choose the value which is already there for Connection-factory as Location (like connection-factory location=?). Use the value of Location as JNDI Name.
Transaction will be No Transaction. Choose this for now. This is need basis selection.
Leave other selection as is and then Finish.
Note : Once you finish. Go to Properties Tab again and look for a property name : xADataSourceName. Its value should be the same as UIConnectionName that you have in *.jca file. It should be populated. If not then you can set now as well. You have to double click on the value section and then write the name and press enter. Then Save it.
With above all steps we have set the DbAdaptor to point to same DB where we have our table/store procedure.
What we did above is:
• We Have JCA File and WSDL for our service. Along with DB Setting.
• We have a Data Source for our DB in WLS.
• We have the deployed DbAdaptor in WLS which is pointing to the same JNDI.
Steps in OSB Console
Create a Project.
Create 3 folders under Project. Like Resources, Proxy Service, Business Service.
Activate your project.
In Resources folder. We have to add JCA Mapping. Point it to the *.jca we already have from above steps (We had created it JDeveloper). Just give the path and Save. It may give you Error. Ignore for Now.
In Resources Folder. Add a WSDL and give the path of your *.wsdl. If it give Error. Then ignore for now.
In Resources Folder. Add a XSD and give path for the *.xsd we already have.
In Resources Folder. Add a XML and give path to the file *Mapping.xml.
Revisit resource WSDL again and click on its name. “Edit References”. Choose the XSD you already have and Save.
Revisit resource JCA and click on its name and edit reference and point it to the mapping.xml
By now you will see all errors gone.
Activate your project.
Go to Left hand side and select the Business Service and Create Business Service by selecting the wsdl project. On next page select Binding.
Then select JCA and give the ‘Location’ of IES (remember we have a value in connection-Factory in *.jca as Location. We had used it while creating DbAdaptor). Give that value here.
Move to next, next and next and finish.
Your business service is all set.
Now create a Proxy Service. Select Proxy Service and choose from B usiness Service option and do select the Business service you have create in above step.
Then click done
Activate your project.
That’s it we are all set. In proxy service you can click and see what is the End Point URl and keep it safe for your future reference. This is the url that we hav eto give on Client to call our service.
With this we all Done.
Call from Client.
Select SOAPUi for this purpose.
Create new project and give the end Point URL.
It will show all the services in it.
Select one service. Create Request.
Put the values in Request XML and Use the endpoint URL by appending your Localhost:port.
Click go and you will see the response back.
So, Finally : We are done with testing a OSB project with DB adaptor.
This looks long, but once you do it, its very easy for next services.
Thanks, Hope that will help.
The OSB Console does not support creation of the JCA DB Adapters, and neither does OEPE.
You need to create the DB Adapter in JDeveloper and then import it via OEPE/OSB Console. OEPE is easier ;-).
For a guide, see:
http://guidoschmutz.wordpress.com/2010/08/08/oracle-service-bus-11g-and-db-adapter-a-different-more-integrated-approach/
or
https://blogs.oracle.com/middleware/entry/using_jca_adapter_with_osb_11113

EFCodeFirst 4.2 and Provider Manifest tokens

I have a library that I have created that depends on EF Codefirst for DB interaction. I am also using EntityMigrations Alpha 3. When I use the library in my main application (WPF) everything works fine and as expected. Another part of the system uses Excel and retrieves information using the same library via an additional COM class in between.
In the Excel scenario, as soon as it tries to connect to the database, it throws up an exception to do with "The Provider did not return a ProviderManifestToken".
I'm really not sure why I'm only getting the error when I go through Excel/COM. In both scenarios I can confirm that the same DB connection string is being used. THe method to retrieve the DB Connection string is also the same - they use a shared config file & loader class.
Any suggestions welcome.
Issue resolved.
I had also created a custom DBIntializer and part of the intialization calls upon EntityMigrations to ensure the DB is up to date. The custom migration calls the default constructor on your context. By convention this will either dynamically use it's own connection string for SQLExpress(I don't have installed) or try to look for an entry in your config file (I don't have this either for the dll - config comes from hosting apps).
This is what is causing the failure when being used from Excel(In my scenario). The Migration will be newing up an instance of the context using the default constructor. This means that a config entry for the connection string is required or it uses the default process(SQLExpress). When being used from Excel in a COM env – no config file exists.
Moving the migration out of the Initialization strategy means I no longer have a problem.

Resources