Mysql executeQuery...
I'm stuck with my code :(
I changing from Interbase to mysql but for some reason I cannot make
them work if resultsets should be Map[]
This works with
Interbase:#######################################################
private Map[] information(int OrderID, int nro) throws Exception
{
String queryFile = "SELECT ORDER_DET.REMOTENAME, ORDER_DET.PID,
ORDER_DET.QTY, ORDER_DET.VARIABLELENGTH FROM ORDER_DET WHERE
(ORDER_DET.ORDID = ?) AND (ORDER_DET.RNBR = ?)";
String[] argsFile = new String[2];
argsFile[0] = OrderID + "";
argsFile[1] = nro + "";
Map[] retmapFile = null;
try
{
retmapFile = connection.executeQuery(queryFile, argsFile);
}
catch (Exception e)
{
System.out.println ("Failed to query information ...");
e.printStackTrace ();
}
return retmapFile;
}
This is what I'm
trying#########################################################
private Map[] information(int OrderID, int nro) throws Exception
{
String queryFile = "SELECT ORDER_DET.REMOTENAME, ORDER_DET.PID,
ORDER_DET.QTY, ORDER_DET.VARIABLELENGTH FROM ORDER_DET WHERE
(ORDER_DET.ORDID = ?) AND (ORDER_DET.RNBR = ?)";
String[] argsFile = new String[2];
argsFile[0] = OrderID + "";
argsFile[1] = nro + "";
Map[] retmapFile = null;
try
{
Class.forName(DRIVER).newInstance();
Connection conn=DriverManager.getConnection(URL);
PreparedStatement smt = conn.prepareStatement(queryFile, argsFile);
retmapFile = smt.executeQuery(); }
catch (Exception e)
{
System.out.println ("Failed to query information ...");
e.printStackTrace ();
}
return retmapFile;
}
Error:
found : java.sql.ResultSet
required: java.util.Map[]
retmapFile = smt.executeQuery();
java.util.Map is imported. What I'm doing wrong?
-Event