Python, unix and mssql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • francisl

    #1

    Python, unix and mssql

    We have to build some script were I work to make a dynamic server inventory.

    But, the project team, a windows crew, start it all in vbscript and on
    mssql. Note, due to political reason, we can not use mysql or anyother
    one that are not *authorize*, it's oracle or mssql. Now we have to make
    it work also with our sun and HP unix server(plus one Linux).

    So I propose to use python, and after they see my litle python/wxwindow
    program, that list windows registry value relate to SUS automatic update
    and that let it remotely force a check. They were amaze on how short it
    took to make us save a lot of time. - Windows by default put a static
    value in its LastWaitTimeout key, in their doc they said 48 hrs. But 48
    hrs is to long for a good schedule on production server. Plus it give us
    headaches to validate all the update on our network. (~75 winnt/2k/2k3
    servers)

    back to subject
    Question.
    Can we, directly from unix select and insert data in a remote mssql
    database?

    if not, my second though was to put a litle python server on the server
    holding the mssql database, which will accept request and insert it in
    the database. But is that possible?

    Thank you
  • Peter Hansen

    #2
    Re: Python, unix and mssql

    francisl wrote:[color=blue]
    > Can we, directly from unix select and insert data in a remote mssql
    > database?[/color]

    Sorry, I can't answer that one.
    [color=blue]
    > if not, my second though was to put a litle python server on the server
    > holding the mssql database, which will accept request and insert it in
    > the database. But is that possible?[/color]

    Definitely possible. You could, for example, use Pyro
    quite effectively for something like that.

    -Peter

    Comment

    • Scott David Daniels

      #3
      Re: Python, unix and mssql

      francisl wrote:
      [color=blue]
      > Can we, directly from unix select and insert data in a remote mssql
      > database?
      >[/color]
      In some sense you can. I used python and mxODBC to talk ODBC protocol
      to DB2 / MS SqlServer / Access. It was quite a while ago, and I may
      have had to use an odbc-on-linux piece I don't know about. But the
      upshot was that my (large, data and CPU-intensive) program ran portably
      on both Win2K and Linux. The mxODBC solution will cost money, but not
      a lot (and MAL has done a great job letting you discover things about
      the far end of the ODBC connection -- development is simple). The
      switch between databases was really minimal effort on my part -- the
      sysadmin who had to create and backup the DBs was not as sanguine about
      the changes. Check with Marc-Andre about the current state of the art
      for linux ODBC drivers.
      [color=blue]
      > if not, my second though was to put a litle python server on the server
      > holding the mssql database, which will accept request and insert it in
      > the database. But is that possible?[/color]
      This is also easy, and you can simply design a little socket watcher to
      get commands, execute them, and return results.
      [color=blue]
      > Thank you[/color]

      Comment

      • Steve Holden

        #4
        Re: Python, unix and mssql

        francisl wrote:
        [color=blue]
        > We have to build some script were I work to make a dynamic server
        > inventory.
        >
        > But, the project team, a windows crew, start it all in vbscript and on
        > mssql. Note, due to political reason, we can not use mysql or anyother
        > one that are not *authorize*, it's oracle or mssql. Now we have to make
        > it work also with our sun and HP unix server(plus one Linux).
        >
        > So I propose to use python, and after they see my litle python/wxwindow
        > program, that list windows registry value relate to SUS automatic update
        > and that let it remotely force a check. They were amaze on how short it
        > took to make us save a lot of time. - Windows by default put a static
        > value in its LastWaitTimeout key, in their doc they said 48 hrs. But 48
        > hrs is to long for a good schedule on production server. Plus it give us
        > headaches to validate all the update on our network. (~75 winnt/2k/2k3
        > servers)
        >
        > back to subject
        > Question.
        > Can we, directly from unix select and insert data in a remote mssql
        > database?
        >
        > if not, my second though was to put a litle python server on the server
        > holding the mssql database, which will accept request and insert it in
        > the database. But is that possible?
        >
        > Thank you[/color]

        If ODBC access is permissible then you could, for example, use mxODBC on
        top of one of the generic ODBC drivers for Unix.

        Since Oracle is also an "approved" database you might also want to think
        about using the cxOracle module, which AFAIK is available on both
        Windows and Unix-like platforms.

        There are several ways you could have remote Python processes talking to
        each other. Pyro is a package that would let you handle this situation
        relatively easily, and I'm sure others will chime in with their favored
        solutions.

        regards
        Steve
        --
        Steve Holden http://www.holdenweb.com/
        Python Web Programming http://pydish.holdenweb.com/
        Holden Web LLC +1 703 861 4237 +1 800 494 3119

        Comment

        Working...