This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

dipti khullar

+ Follow
since Oct 23, 2008
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dipti khullar

I am using DOM parser for parsing aboyt 50000 XMLs.

Call to parse function : -

Problem is with special characters. Since our site is supporting Arabic language, characters like , causes problem in parser.

I cannot use InputStream instead of new File() because of performance issues.
Is there some other way to set some encoding format to the file, without opening it? Or how can i remove invalid characters while XML parsing?
Hi Balu Sadhasivam

Thanks a lot for your reply.

Please see if things are more visible now.

Exception: java.sql.SQLException: Invalid parameter index 3.
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.getParameter(
at net.sourceforge.jtds.jdbc.JtdsCallableStatement.registerOutParameter(
at net.sourceforge.jtds.jdbc.JtdsCallableStatement.registerOutParameter(
at routines.GetArticleContent_sp.getArticleContent_sp(
at redbullmigration_20090407.trial_0_1.trial.tJava_1Process(
at redbullmigration_20090407.trial_0_1.trial.runJobInTOS(
at redbullmigration_20090407.trial_0_1.trial.main(

I want to use the resultset values retrieved from the SP. I am not very much clear about the syntax and usage of registerOutParameter. But, I tried following thing after referring to some posts. Following exception is thrown: java.sql.SQLException: Invalid parameter index 3

Code Snippet:

CallableStatement proc = null;
Statement stmt_MSSql = con_MSSql.createStatement();
ResultSet rs_MSSql = stmt_MSSql.executeQuery("SELECT top 5 pageID FROM A_Pages WHERE fkPageTypeID = 25");
ResultSet rs_proc_MSSql = null;
proc = con_MSSql.prepareCall("{ call AAA_PageLanguages(?,?,?) }");

//proc.registerOutParameter(2, java.sql.Types.VARCHAR);
proc.setInt(1, rs_MSSql.getInt(1));
proc.registerOutParameter(2, java.sql.Types.INTEGER);
proc.registerOutParameter(3, java.sql.Types.VARCHAR);
rs_proc_MSSql = proc.executeQuery();

//rs_proc_MSSql = (ResultSet)proc.getObject(1);
while ( {
System.out.println(rs_proc_MSSql.getInt(1) + "\t" +


SP (Input : pageID and Output : pkID, LanguageID)

pkID AS ID , LanguageID
tblPageLanguage AS PL INNER JOIN tblLanguageBranch AS LB ON
(PL.fkLanguageBranchID = LB.pkID) WHERE PL.fkPageID = @pageID

Thanks a lot for your reply.

You were absolutely right.
But that resultset iteration problem is still not resolved.

I found another way of implementing that some time back using function calls and passing relevant info into that.

Thanks. It really helped and saved my considerable time of debugging.
package routines;
import java.sql.*;

public class GetCategoryName {

public static void getCategoryName() {
try {
Connection con=null;
Statement s=con.createStatement();
String category = "";
String [] list = {};
String list_cat = "";
int id_av=0;
int count=0;
ResultSet rs_category=null;

ResultSet rs_breadcrumb = s.executeQuery("select ID_AUDIOVIDEO, SOURCE_SYSTEM_BREADCRUMB from AUDIOVIDEO");

while( {

id_av = rs_breadcrumb.getInt(1);
category = rs_breadcrumb.getString(2);
System.out.println("id_av " + rs_breadcrumb.getInt(1));
System.out.println("category_ID " + rs_breadcrumb.getString(2));

rs_category = s.executeQuery("select CATEGORY_NAME from RBAR_CATEGORY WHERE ID_CATEGORY IN (" + category + ")");;
list[0] = rs_category.getString(1);
for(int i=1;;i++)
{ list[i] = list[0] + "," + rs_category.getString(1);
System.out.println("list " + list[i]);
//I will be able to update the record, but the value in list is incorrect.

} catch(Exception e){e.printStackTrace();}

Problem 1: First loop. executes only once for the first row and it breaks
Problem 2: The list[i] doesn't store correct values, it throws exception.

Summarizing the issue:

SOURCE_SYSTEM_BREADCRUMB stores the ID_CATEGORY values as "1,2,3,4,5"
which I need to replace with "cat1,cat2,cat3.cat4", corresponding to ID_AUDIOVIDEO, which means using nested resultsets.