[python-sybase] Sybase.DatabaseError when execute "dump database" commmand use Sybase.connect().cursor().execute()

Chris Curvey ccurvey at gmail.com
Mon Nov 28 06:21:53 EST 2005


The Sybase libraries (the C-level ones, not the python ones) use "errors" to
communicate all kinds of things (like database names after "use database").
Catch the exception and check for message 3216.  Since it's a known message,
you can ignore it.

-Chris

P.S.  Of course, you'll need to be sure that you won't need to signal a
volume change during the backup, becase you need the information in the
message to be able to do that properly.

On 11/25/05, Wang King <wangkknd at gmail.com> wrote:
>
> Sybase Module for python had been installed successful.
> My commands like this:
> >>> from Sybase import *
> >>> a = connect('SYBASE','sa','')
> >>> a
> <Sybase.Connection instance at 0x0093BBC0>
>
> >>> cur = a.cursor()
> >>> cur
> <Sybase.Cursor instance at 0x00934350>
> >>> cur.execute('dump database test to "c:\\test" ')
>
> The result like this:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "D:\Python24\Lib\site-packages\Sybase.py", line 764, in execute
>     self.description = fetcher.start(self.arraysize)
>   File "D:\Python24\Lib\site-packages\Sybase.py", line 515, in start
>     return self._start_results()
>   File "D:\Python24\Lib\site-packages\Sybase.py", line 619, in
> _start_results
>     status, result = self._cmd.ct_results()
>   File "D:\Python24\Lib\site-packages\Sybase.py", line 200, in
> _servermsg_cb
>     raise DatabaseError(_fmt_server(msg))
> Sybase.DatabaseError: Msg 3216, Level 10, State 1, Line 1
> Backup Server session id is:  47.  Use this value when executing the
> 'sp_volchan
> ged' system stored procedure after fulfilling any volume change request
> from the
> Backup Server.
> Msg 404101, Level 1, State 1, Procedure bs_write_header
> Backup Server: 4.41.1.1: Creating new disk file c:\test.
>
> But the database has been dumped successful.
>
> How can I dump database by python?
>
> _______________________________________________
> Python-sybase mailing list
> Python-sybase at www.object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase
>
>
>


--
Nervous passengers are advised to wear a blindfold.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.object-craft.com.au/pipermail/python-sybase/attachments/20051127/266bbf06/attachment.htm


More information about the Python-sybase mailing list