web stats
Login failed for user - Mirth Connect 3.03 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2014, 12:27 PM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Question Login failed for user - Mirth Connect 3.03

I am getting the message below after upgrading to version 3.03 from 2.2.3
I have ensured that the user specified can access the SQL database directly, by establishing a connection with that user in MS SS 2012.

Any help would be greatly appreciated

Quote:
[2014-07-09 13:00:15,887] ERROR (com.mirth.connect.server.controllers.DonkeyEngine Controller:177): Error executing global deploy script.
com.mirth.connect.server.util.javascript.JavaScrip tExecutorException: com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:
554:

}555:
}556:
557:
//Finally, get all enabled pool channels 558: logger.info(sDriver + " " + sConnectionString + " " + sUserName + " " + sPassword);559:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection (sDriver, sConnectionString, sUserName, sPassword);560:
var query = "SELECT [NAME] FROM CHANNEL WHERE [NAME] Like '" + sDestinationConnectionPoolsChannelNamePrefix + 561:
"%' AND IS_ENABLED = 1 Order by [NAME]";562:
var dr = dbConn.executeCachedQuery(query);563:
while (dr.next())LINE NUMBER:
559DETAILS:
Wrapped java.sql.SQLException: Login failed for user 'Mirth_NHA_POI_User'.
at Deploy:559 (TD_LoadConnectionPools)
at Deploy:778 (doScript)
at Deploy:851
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.execute(JavaScriptUtil.java:63)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeGlobalDeployScript(JavaScriptUtil.jav a:396)
at com.mirth.connect.server.controllers.DefaultScript Controller.executeGlobalDeployScript(DefaultScript Controller.java:137)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.deployChannels(DonkeyEngineController.ja va:175)
at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.redeployAllChannels(DonkeyEngineControll er.java:328)
at com.mirth.connect.server.Mirth.startup(Mirth.java: 270)
at com.mirth.connect.server.Mirth.run(Mirth.java:154) Caused by: com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:
554:

}555:
}556:
557:
//Finally, get all enabled pool channels 558: logger.info(sDriver + " " + sConnectionString + " " + sUserName + " " + sPassword);559:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection (sDriver, sConnectionString, sUserName, sPassword);560:
var query = "SELECT [NAME] FROM CHANNEL WHERE [NAME] Like '" + sDestinationConnectionPoolsChannelNamePrefix + 561:
"%' AND IS_ENABLED = 1 Order by [NAME]";562:
var dr = dbConn.executeCachedQuery(query);563:
while (dr.next())LINE NUMBER:
559DETAILS:
Wrapped java.sql.SQLException: Login failed for user 'Mirth_NHA_POI_User'.
at Deploy:559 (TD_LoadConnectionPools)
at Deploy:778 (doScript)
at Deploy:851
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:490)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil$4.call(JavaScriptUtil.java:402)
at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)Caused by: java.sql.SQLException: Login failed for user 'Mirth_NHA_POI_User'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnos tic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(Td sCore.java:2894)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCor e.java:2334)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.ja va:614)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(C onnectionJDBC2.java:356)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(C onnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.ja va:185)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.mirth.connect.server.userutil.DatabaseConnecti on.<init>(DatabaseConnection.java:62)
at com.mirth.connect.server.userutil.DatabaseConnecti onFactory.createDatabaseConnection(DatabaseConnect ionFactory.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox. java:126)
at org.mozilla.javascript.NativeJavaMethod.call(Nativ eJavaMethod.java:225)
at org.mozilla.javascript.Interpreter.interpretLoop(I nterpreter.java:1473)
at org.mozilla.javascript.Interpreter.interpret(Inter preter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(In terpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:3110)
at org.mozilla.javascript.InterpretedFunction.exec(In terpretedFunction.java:120)
at com.mirth.connect.server.util.javascript.JavaScrip tTask.executeScript(JavaScriptTask.java:49)
at com.mirth.connect.server.util.javascript.JavaScrip tUtil.executeScript(JavaScriptUtil.java:485)
... 6 more
Reply With Quote
  #2  
Old 07-10-2014, 05:31 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,282
cory_cole is on a distinguished road
Default

Did you change DBs?

Login failed for user 'Mirth_NHA_POI_User'.
Reply With Quote
  #3  
Old 07-10-2014, 07:16 AM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Default

same databases, an i can log in directly to that database on that server using the same credentials, with no issue.

Failing here: var dbConn = DatabaseConnectionFactory.createDatabaseConnection (sDriver, sConnectionString, sUserName, sPassword);
var dr = dbConn.executeCachedQuery(query);

Has anything changed with DatabaseConnectionFactory and its methods?

Last edited by clarksss; 07-10-2014 at 07:18 AM. Reason: added code
Reply With Quote
  #4  
Old 07-10-2014, 07:30 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,282
cory_cole is on a distinguished road
Default

Are you sure the variables are getting loaded?
Reply With Quote
  #5  
Old 07-10-2014, 08:43 AM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Default

I am certain the variables are getting loaded.. i have printed them to the Log using Logger and all parameters look good. could it be the driver?

ERROR (deploy:?): 'net.sourceforge.jtds.jdbc.Driver'
'jdbc:jtds:sqlserver://IHSERV0042:1433/MIRTH_NHA_CIX;
'username'
'password'
Reply With Quote
  #6  
Old 07-10-2014, 10:34 AM
brlmcguire brlmcguire is offline
OBX.2 Kenobi
 
Join Date: Dec 2012
Location: Prince George, BC, Canada
Posts: 84
brlmcguire is on a distinguished road
Default executeCachedQuery

Hi Stace.

It looks like the executeCachedQuery method only has two ways to call it in the new version.

According to the Programming Reference from the training, executeCachedQuery can be called with just the query, or with the query and a list of parameters, as follows:

executeCachedQuery(string expression)
execureCachedQuery(string expresssion, List<Object> parameters)

Ditto for executeUpdate

What we have done is to create a code template that gets us a connection, and we pass it the username and password for the connection.

Then we call theconnection.executeCachedQuery(qry, params)

This methodology appears to work in the current version.

Here is the code for our get connection code template.

Code:
function getConn(connnm, drvr, url, usr, pwd)
{
	var dbConn = $g(connnm);
	var valid = false;

	if (dbConn && !dbConn.getConnection().isClosed())
	{
		try
		{
			dbConn.executeCachedQuery('SELECT 1');
			valid = true;
		}
		catch (e)
		{}
	}

	if (!valid)
	{
		dbConn = DatabaseConnectionFactory.createDatabaseConnection(drvr, url, usr, pwd);
		$g(connnm, dbConn);
	}

	return dbConn;
}
And here is a code snippet showing how we use it.

Code:
var dbcert = "jdbc:jtds:sqlserver://pathtoserver:1433/dbname";
var dbConn = getConn('cpi', 'net.sourceforge.jtds.jdbc.Driver', dbcert, 'TheUser', 'ThePassword');



	var params = new Packages.java.util.ArrayList();
	params.add($('namelast'));

	var upd = "";
	upd += " INSERT INTO dbo.tblCPI";
	upd += " (CPI_Last_Name)";
	upd += " VALUES (?)";

	dbConn.executeUpdate(upd, params);
Pared down for brevity, of course.

Do let me know if you have any more questions,

Bruce.
Reply With Quote
  #7  
Old 07-10-2014, 10:37 AM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Default

This fails
var dbConn = DatabaseConnectionFactory.createDatabaseConnection (sDriver, sConnectionString, sUserName,sPassword);

This works
var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver', 'jdbc:jtds:sqlserver://cpriadc7:1433/Mirth3_0', 'username', 'password');

Seems that it does not like the parameters being passed in. I have tried passing in parmameters with single quotes, but still the same error... any idea why hard coding works and not variables? (string formatting or something??)

Last edited by clarksss; 07-10-2014 at 11:04 AM. Reason: wording change
Reply With Quote
  #8  
Old 07-10-2014, 10:39 AM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Default

Quote:
Originally Posted by brlmcguire View Post
Hi Stace.

It looks like the executeCachedQuery method only has two ways to call it in the new version.

According to the Programming Reference from the training, executeCachedQuery can be called with just the query, or with the query and a list of parameters, as follows:

executeCachedQuery(string expression)
execureCachedQuery(string expresssion, List<Object> parameters)

Ditto for executeUpdate

What we have done is to create a code template that gets us a connection, and we pass it the username and password for the connection.

Then we call theconnection.executeCachedQuery(qry, params)

This methodology appears to work in the current version.

Here is the code for our get connection code template.

Code:
function getConn(connnm, drvr, url, usr, pwd)
{
	var dbConn = $g(connnm);
	var valid = false;

	if (dbConn && !dbConn.getConnection().isClosed())
	{
		try
		{
			dbConn.executeCachedQuery('SELECT 1');
			valid = true;
		}
		catch (e)
		{}
	}

	if (!valid)
	{
		dbConn = DatabaseConnectionFactory.createDatabaseConnection(drvr, url, usr, pwd);
		$g(connnm, dbConn);
	}

	return dbConn;
}
And here is a code snippet showing how we use it.

Code:
var dbcert = "jdbc:jtds:sqlserver://pathtoserver:1433/dbname";
var dbConn = getConn('cpi', 'net.sourceforge.jtds.jdbc.Driver', dbcert, 'TheUser', 'ThePassword');



	var params = new Packages.java.util.ArrayList();
	params.add($('namelast'));

	var upd = "";
	upd += " INSERT INTO dbo.tblCPI";
	upd += " (CPI_Last_Name)";
	upd += " VALUES (?)";

	dbConn.executeUpdate(upd, params);
Pared down for brevity, of course.

Do let me know if you have any more questions,

Bruce.
Oh ok, i will try the above code
Reply With Quote
  #9  
Old 07-10-2014, 11:41 AM
clarksss clarksss is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 75
clarksss is on a distinguished road
Thumbs up Solution

sorry for wasting everyone's time.
Thanks Kent for noticing the carriage return

I have added this to the to variables that i have passed in:
.replaceAll("[\r\n]","");
Reply With Quote
Reply

Tags
login failed for user, mirth 3.0, mirth 3.03, ss 2012

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:23 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation