Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB2 Help Required (Backup)

Status
Not open for further replies.

ddprasad

Programmer
Jul 29, 2003
7
IN
For Quite a Few Days I am trying to develop an interactive backup interface using both java swing and also on Visual C++. Both of them stuck at a point where I am trying to execute SQL backup command.

The following command works fine from Command Center:

backup database ddp to c:\testdb2\dp

But When the same command is executed through
ExecuteSQL of CDatabase in Visual C++ and execute() of Statement in Java Swing I Get the following error message:

java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0007N The character "\" following "P DATABASE DDP TO c:" is not valid. SQLSTATE=42601

I would be thankful if any one can sort out the problem.
 
Have you tried with two slashes or with single slash.

I mean have you given the command in the following format.
backup database ddp to c:\\testdb2\\dp

If not try it....
 
ddprasad,

try using forward slashes, in either your command or that suggested by fahmy80. I realise it's not how you would expect, but I believe it may get resolved correctly.

Cheers
Greg
 
It is very unfortunate to say that I have tried these earlier but this gave this error:

java.sql.SQLException: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token &quot;DATABASE&quot; was found following &quot;BACKUP &quot;. Expected tokens may include: &quot;JOIN <joined_table>&quot;. SQLSTATE=42601


 
Further thoughts

Try the following for your slashes.

c:\\testdb2\dp

Also is c:\testdb2\dp an existing directory?

Cheers
Greg
 
Are you trying the backup as SQL Statement?

It is likely to fail because backup is not SQL but a command ...

You can try to run it as OS comamnd within your appl.
Eg:

db2cmd /c /w /i db2 backup database ddp to c:\testdb2\dp

Cheers
Sathyaram

More DB2 questions answered at
 
I Think 'sathyarams' is correct. I will try this and will turn up tomorrow.

Thanks for everyone.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top