I was just testing the database writer/database reader. I have the following code for source connector.
And my destination I had a Database Writer and the following code
I am not able to insert the record into the tmpdev table using the above logic. Is something wrong with the code? Your help will be appreciated.
Code:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:«»sqlserver://xxx.xxx.xx.xx:«»xxxx/LocalDB','xx','xxxx'); var result = dbConn.executeCachedQuery("Exec sp_test_S"«»); var temp = ""; while(result.next()) { temp = result.GetString(0).ToString() + ","; } temp = temp.Substring(0, temp.Length - 1); dbConn.close(); channelMap.put("Results", temp); return temp;
Code:
var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:«»sqlserver://xxx.xxx.xx.xxx:1433/LocalDB','sa','xxxx'); var expression = "Insert into tmpDev(TempVisitID) values(" + channelMap.get("Results"«») + "«»)"; var result = dbConn.executeUpdate(expression); dbConn.close();
Comment