The Artima Developer Community
Sponsored Link

Java Answers Forum
Function sequence error??

3 replies on 1 page. Most recent reply: Apr 4, 2002 2:27 AM by Thomas SMETS

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

Function sequence error?? Posted: Apr 3, 2002 5:46 AM
Reply to this message Reply
Advertisement
The program i'm writing has a method which queries an access db but when it is called several times in a row it throws up a Function sequence error and I have no idea what it means or how to get around it. Does anyone have any ideas?


Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: Function sequence error?? Posted: Apr 3, 2002 5:58 AM
Reply to this message Reply
Are you calling Commit on a connection while having open result sets on the connection?

Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

Re: Function sequence error?? Posted: Apr 3, 2002 9:30 AM
Reply to this message Reply
no, the method works fine the first two times but on the third time that's when I get the error

the method is

public String getCoAuthors(String anISBN)throws SQLException
{
coAuthors = "";
coAuthorNums = new int[3];
index = 0;

//get each of the co-authors numbers
query = "SELECT * FROM intersection WHERE isbn ='" + anISBN+"'";
results = statement.executeQuery(query);

while (results.next())
{
coAuthorNums[index] = results.getInt("authorNumber");
index++;
}

for(int i = 0; i < index ; i++)
{
query = "SELECT * FROM author WHERE authorNumber =" + coAuthorNums+"";
results = statement.executeQuery(query);
while (results.next())
{
coAuthors += results.getString("firstName");
coAuthors += " ";
coAuthors += results.getString("surname");
coAuthors += "\n";
}
//coAuthors += this.getAuthorName(coAuthorNums) + "\n";
}
return coAuthors;
}

Does this help? im completely confused

Thomas SMETS

Posts: 307
Nickname: tsmets
Registered: Apr, 2002

Re: Function sequence error?? Posted: Apr 4, 2002 2:27 AM
Reply to this message Reply
Can you preceiselly show what functionis call when the exception is thrown & what trace you get !
try
{
// Nasty code here !
} catch(Exception e)
{
System.out.println("Exception type is " + e.getClass().getName());
e.printStackTrace();
}

tx

Flat View: This topic has 3 replies on 1 page
Topic: Programming a forum in Java Previous Topic   Next Topic Topic: How to overcome this

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use