Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc and ms access with stored query

 
brush
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble executine a stored query in microsoft access. Is the syntax the same for stored queries in ms access the same as sql server. Here is the code the I am trying
public DBResultSet executeStoredProcedure(String theCall ){
String[] a;
Statement st;
Connection c;
ResultSet rs;
CallableStatement cs;
DBResultSet aResultSet;
try{
System.out.println("Stored Procedure is \n" + theCall + "\n");
if (this.isConnected() == false )
return null;
c = this.getConnection();
if ( c != null ){
cs = c.prepareCall(theCall);
rs = cs.executeQuery();
System.out.println("Prepared Statement" + theCall + "\n");
}else{
System.out.println("Can not execute query. No connection");
return null;
}
aResultSet = new DBResultSet( rs );
cs.close();
this.connection.close();
return aResultSet;
}catch(SQLException sql ){
System.out.println("SQL Exception in executeQuery");
sql.printStackTrace();
return null;
}
}
Any help with the syntax of stored queries and ms access is appreciated
------------------
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, which you agreed to when you registered, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. A single charaacter for a last name is not acceptable. Please choose a new name which meets the requirements.
Thanks.

------------------
Moderator of the JDBC Forum
 
brush
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
O.K Where do I change my username? Do I have to re register?
Thanks for the help
Brian
Originally posted by Thomas Paul:
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, which you agreed to when you registered, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. A single charaacter for a last name is not acceptable. Please choose a new name which meets the requirements.
Thanks.


 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, just re-register with a new name. Your old name will soon be disabled.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic