calling an extended stored procedure from java

S

suken

Hi,
Can anyone tell me how can we call an extended stored procedure using
jdbc.

Basically i want to do this.

Exec Master..xp_CmdShell 'bcp "Select top 10 * from SalesOrder"
queryout "d:\test1.xls" -c -U "sa" -P "password"'

I am trying to call it using a normal callable statement like this

strQuery = Master..xp_CmdShell 'bcp "Select top 10 * from SalesOrder"
queryout "d:\test1.xls" -c -U "sa" -P "password"';
connection.prepareCall("{call "+ strQuery+" }");

but it fails throwing an SQL Exception as

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Syntax error
or access violation


can anyone help.
Thanks in advance.
Suken
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top