accessing an Access-query from an applet

W

wnstnsmith

Dear all,

Maybe I'm stupid, in any case I'm stupefied by now. Please help.

Stored procedures in Access should be accessible from a java-applet throught
a callable statement, but all I get is error messages from Access, which
tell me nothing.

Can anybody tell me what is wrong with the following:

In an Access database, I have a selectionquery called TEST, which simply
yields a set of string values:

This is the query in the database:
SELECT name FROM dogs

The output should be someting like:
Spot
George
Fido
....

Now this is the Java-call:
String query = "{ ? = call test }";
CallableStatement cal = theExistingConnection.prepareCall(query);
cal.executeQuery();
ResultSet r = cal.getResultSet();

The execute-statement fails, returning SQLException 70002: field COUNT is
incorrect. Why?

And while we're at it, is there a CLEAR example anywhere on the net of
stored-procedure calls and what parameters to set and why?

Thanks in advance,

WS
 
S

Sudsy

Dear all,

Maybe I'm stupid, in any case I'm stupefied by now. Please help.

Possibly, but that's beside the point...

Now this is the Java-call:
String query = "{ ? = call test }";

I checked some of my code and it looks more like this:

String query = "{?= call test() }";

Note spacing and lack thereof. I seem to recall spending some time
getting this right...
CallableStatement cal = theExistingConnection.prepareCall(query);

Missing something important here! How about this:

cal.registerOutParameter( 1, java.sql.Types.VARCHAR );
cal.executeQuery();
ResultSet r = cal.getResultSet();

Now you should be away to the races!

Thanks in advance,

WS

You're welcome in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top