SQL2000 database vs python

Hans Nowak zephyr01 at alltel.net
Thu Jul 31 17:44:18 CEST 2003


Raaijmakers, Vincent (IndSys, GE Interlogix) wrote:
> Ok I was too happy.
> 
> mssqldb doesn't help me to connect my python app on a linux OS to a sql2000 (windows os) database.
> I can't even compile the package, I guess it is missing sybase stuff (sybdb.h and sybfront.h), 
> which is correct because I don't have that database.
> Also, mssqldb supports ms sql server 7.0, my hope is that that won't be a problem in using ms sql 2000.
> 
> Pfew, there goes my hope.

If anything else fails, you can use SQLXML.  I don't have a link handy, but it 
should be easy to find on Google.  What you do is the following:

1. Install SQLXML on Windows machine (if it isn't there already)
2. From Linux, talk to database using XML "updategrams" over HTTP.

For example, you can insert a record like this:

<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
  <updg:sync >
   <updg:before>
   </updg:before>
   <updg:after>
    <Orders updg:at-identity="x" CustomerID="ALFKI" OrderDate="07/18/00" />
       <Order_x0020_Details OrderID="x"
             ProductID="11"
             UnitPrice="$1.0"
             Quantity="1"
             Discount="0.0" />
     </updg:after>
   </updg:sync>
</ROOT>

Not pretty, but it works.  You can also issue SQL statements using an URL.

Caveats: Creating updategrams is not extremely easy, and you'll probably want 
to write some custom Python routines to execute SQL, create an updategram, send 
it, interpret data you get back (this is XML as well), etc.

HTH,






More information about the Python-list mailing list