Help querying DB2 with LS2J JDBC

Hi everyone :

This is the first time i am trying to use JDBC via LotusScript (LS2J).

I can get connected to a DB2 server, but i’m not sure how to run a query and retrieve the result.

This is the code i am using…

The Java Class :

=====================

public class JDAL {

private Connection con = null;

private PreparedStatement st=null;

private ResultSet rs=null;



public ResultSet getData( String query) throws SQLException 

{

	st = con.prepareStatement(query);

	rs = st.executeQuery();

	return rs;

}



public void openConnection(String server, String database, String port, String user, String pass) throws ClassNotFoundException, SQLException

{

	String url = "jdbc:db2://"+server+":"+port+"/" + database;

	Class.forName("com.ibm.db2.jcc.DB2Driver");

	con = DriverManager.getConnection(url, user, pass);

}



public void closeConnection() throws SQLException

{

	if (rs!= null)

		rs.close();

	if (st!= null)

		st.close();

	if (con!=null)

		con.close();

}

}

========================

The LS code :

========================

UseLSX “*javacon”

Use “com.iga.dal”

Dim jSession As JAVASESSION

Dim jClass As JAVACLASS

Dim jObject As JavaObject

Dim rsClass As Javaclass

Dim rsObject As Javaobject



Set s = New notessession

Set db = s.CurrentDatabase

Set docProfile = db.GetProfileDocument("ProfSetup")



Set jSession = New Javasession

Set jClass = jSession.GetClass("JDAL")

Set jObject = jClass.CreateObject



Dim docCli As NotesDocument



If docProfile Is Nothing Then

	Msgbox "No se encuentra el documento de configuración", 64, title$

	Exit Sub

End If



'Conecta al Host

Print "CargaClientesPeru : Conectando a CLIENTES"

Call jObject.openConnection(docProfile.ClientesServer(0), docProfile.ClientesDatabase(0), docProfile.ClientesPort(0), docProfile.ClientesUser(0), docProfile.ClientesClave(0))	



SQL$ = { select CUSTNUM, ABREVNAM, TAXNUM } + _

{ from CROS_CROVPMN } +_

{ where CTYNUM = '815' }



Set tRes = jObject.getData(SQL$)





call jObject.CloseConnection()



Exit sub

===========================

the jObject IS getting connected to the db2 server; the query is correct as i have tested in the db2 client.

What i am not sure how to do is, to run the query, and then read the result line by line.

Any help will be appreciated.

Thanks