Mirth- Database writer error - database

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"

Related

How use existing connection in Logic Apps Designer

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.

How sql source (RODBC) connects with Shiny?

My question is when or in what instances gets the shiny app refreshed once a SQL RODBC connection is established (or alternatively also other types of connection like RJDBC etc.)?
I connected shiny app to a database using RODBC package:
library(RODBC)
connection <- odbcConnect(dsn, uid = "", pwd = "")
Subsequently I create an object inside R to manipulate further the data:
object<-sqlQuery(connection, "SELECT ALL * FROM <the table>;")
I keep the app running online so others can see the data visualisation. Is the shiny app refreshed from the SQL source every time someone opens the app in the browser or refreshes the browser page?
Or is it a bit more complex and I need to build in an observer in the data input pathway when reading data in from SQL server?
(Note: the SQL source is updated weekly, therefore, I cannot test this at the moment.)
I can only guess based on the code extract, but as I see it your code will never update based on reactivity. I don't see any reactivity in your code, which will automatically update the contents of object. However, it depends where your code is. If your code is inside the server object it should refresh for each session (this is user/refresh/...). However, if something reactive changes like a pressed button it will not update automatically
However you should be able to try it easily
object<-{cat("test");sqlQuery(connection, "SELECT ALL * FROM <the table>;")}

How to confirm test-data from selenium webdriver is stored in the database?

Interview questions:
Suppose you fill-up the fields (eg username , password etc) from Test data Excel sheet using Apache POI. After clicking on Submit button, what happens?
How do you confirm that test data from excel sheet in stored into DB?
What is interface between Selenium WD and the Database?
As far as Selenium is concerned, there is no direct facility given by Selenium to connect with any database to check any stored value.
To check the saved value you have to connect to databases depending on used db like mysql, oracle etc... you have to use supported api to make connection to database first then execute query. An example to execute query on mysql db using java with mysql-connector-java-5.0.8-bin.jar, below code will return a record set which you can use like any other 2 D Array:
String dbClass = "com.mysql.jdbc.Driver";
Class.forName(dbClass);
// Getting Values for dburl,dbUsername and dbPassword from configuration file
String dburl = propertyConfigFile.getProperty("dbURL").toString();
String dbuserName = propertyConfigFile.getProperty("dbUserName").toString();
String dbpassword = propertyConfigFile.getProperty("dbPassword").toString();
qaConnection = (Connection) DriverManager.getConnection (dburl,dbuserName,dbpassword);
Statement stmt = (Statement) con.createStatement();
ResultSet rs = (ResultSet) stmt.executeQuery(sqlQuery);
I would do this much like a user/manual tester would. Refresh the page, clear browser storage/cookies if you feel you should (perhaps by running some extra Javascript in the page), and go to a page where you can verify that the data was entered successfully.
Your example of username/password should be especially easy to test: they should be able to be verified by logging in with those credentials. Of course there could be a scenario where you don't let the user see or verify what they have previously done: but I suspect these are fairly rare.
I suspect also that checking exactly how the data is in the database might be beyond the usual scope of Selenium tests, and would usually be designed to pass even if you've completely re-engineered the backend. However, I see it can be argued that there is value to it being verified, especially at the initial stages of an application where the only effect of something is that something is in the database, before the UI to show it has been created. A number of databases I think offer a low-level web-ui to run queries. You could write a test that fires this up and checks that the data entered by your form is indeed in the database.

Why are added tables from Java not visible when I open the H2 console?

I use an H2 embedded database in Java, and after creating the database and adding some tables and data, it gets saved as a file in a directorey of my computer.
But whenever I open this file with the H2 Console, it shows no tables at all? Why are the tables not there?
I am using this URL in my java code: jdbc:h2:file://C:/Temp/H2/ourDB
And I log into the console with the following information:
After logging in, I can't see the tables that were created in Java?
You have used a different database URL in the H2 Console (not jdbc:h2:file://C:/Temp/H2/ourDB). You need to use the same one, otherwise it's a different database.
The accepted ans is correct- it's URL issue. But for recent user, I am posting the updated values (I am using SpringBoot 2 with Spring Data JPA). When you open H2 Console, the default URL shown for DB Connection is: jdbc:h2:~/test . If you connect using this URL, you won't find the tables you created in your app. But user generated tables to be seen use URL as jdbc:h2:mem:testdb. Pls, refer below figures:
Here EXCHANGE_VALUE was my JPA generated table, that i could see after connecting to db using URL as jdbc:h2:mem:testdb.

How to pass credentials to reportviewer in WPF application SSRS 2008

I am using ReportViewer to show the reports on my windows WPF application using .Net 4.0. These reports are deployed on a separate SSRS 2008 report server and not the local machine. Right now, I am passing the credentials of the server in the following manner:
string userName = configClient.Settings.Get("UserName").Value.ValueXml.InnerText;
string password = configClient.Settings.Get("Password").Value.ValueXml.InnerText;
string domain = configClient.Settings.Get("Domain").Value.ValueXml.InnerText;
IReportServerCredentials irsc = new ReportViewerCredentials(userName, password, domain);
_reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = irsc.NetworkCredentials;
Also, I am using the following settings with the ReportViewer if it is of any use:
_reportViewer.ProcessingMode = ProcessingMode.Remote;
_reportViewer.ShowParameterPrompts = false;
_reportViewer.ServerReport.ReportServerUrl = new Uri(Properties.Settings.Default.ReportServer);
_reportViewer.ServerReport.ReportPath = Properties.Settings.Default.Reports;
I am using the config file to save and retrieve the credentials for the server access, but I do not think this is a secure way of doing it. I would like to implement this in a secure way where I do not need to take the credentials from the user or from the config file. Both the local machine and the server would be on the same network.
I am not sure how to do it, can this be done through impersonation, I am just guessing as I do not have much idea about security and impersonation. Also, if it can be done, can I get a sample or may be a link to an article through which I can get this done.
The core idea is to avoid storing the username and password on the client. I searched for solution but what I got was very vague in nature.
Please do not close this thread as it is an open question, but it is important for me, as I am approaching deadline and working on too many things at a time. Sorry for inconvenience caused if any.
I have found a way to not pass the credentials at all and still be able to retrieve the reports from the Reports Server, but not without help.
I have configured a new Role assignment in the Report Manager using the URL http://localhost/Reports/Pages/Folder.aspx. Go to Properties tab, and add a New Role Assignment and add Everyone and provide the required right to it.
This way, I would not need to pass any credentials from the client for the ReportViewer. Also, it can be used to configure the access for a selected users.

Resources