Data not getting inserted into mySQL DB
Hi, I am trying to get my values into a mySQL DB but for some reason it doesnt seem to go into the DB. I do not get any errors. Would appreciate some guidance on this.
{
/
s pidSeg = pRequest.FindSegment("PID")
s mrn = $p(pidSeg.GetValueAt(3),"^",1)
s obrSeg = pRequest.FindSegment("OBR")
s obrdate = obrSeg.GetValueAt(6)
s obrdesc = $p(obrSeg.GetValueAt(4),"^",2)
s obrstat1 = $p(obrSeg.GetValueAt(40),"^",2)
s obrstat2 = $p(obrSeg.GetValueAt(40),"^",3)
s obrstatus = obrstat1_" "_obrstat2
s orcSeg = pRequest.FindSegment("ORC")
s consultantfname = $p(orcSeg.GetValueAt(12),"^",3)
s consultantsname = $p(orcSeg.GetValueAt(12),"^",2)
s orderconsultant = consultantfname_" "_consultantsname
set conn=##class(%SQLGatewayConnection).%New()
If conn=$$$NULLOREF quit $$$ERROR($$$GeneralError,"Cannot create %SQLGatewayConnection.")
set sc=conn.Connect("databasename","username","password")
If $$$ISERR(sc) quit sc
if conn.ConnectionHandle="" quit $$$ERROR($$$GeneralError,"Connection failed")
set sc=conn.AllocateStatement(.hstmt)
if $$$ISERR(sc) quit sc
//Prepare statement for execution
set pQuery = "INSERT INTO ORDERS(column1, column2, column3, column4, column5) "
set pQuery = pQuery_"VALUES("_value1_","_value2_","_value3_","_value4_","_value5_")"
set sc=conn.Prepare(hstmt,pQuery)
if $$$ISERR(sc) quit sc
//Execute statement
set sc=conn.Execute(hstmt)
if $$$ISERR(sc) quit sc
quit 1
}
UPDATE: So, it seems that I am able to connect to the database, but getting the following Error
ERROR #6022: Gateway Failed. Execute