You are not logged in Log in Join
You are here: Home » Members » Chui Tey » Adding datetime data to an ODBC SQL backend via XMLRPC

Log in
Name

Password

 

Adding datetime data to an ODBC SQL backend via XMLRPC

Introduction

This how to illustrates how to add datetime data to an ODBC-based database via xmlrpc.

Step 1: Create a database connection

Create a database connection called connODBC to your database. Let us assume that you have a table called tblUser with the fields UserID (Text), LastLoginTime (DateTime).

Step 2: Create an INSERT query

Create a SQL query to insert data into the database called sqlAddRow with the following:

   INSERT INTO tblUser ( UserID, LastLoginTime )
   VALUES (
   <dtml-var UserID>,
   {ts <dtml-var LastLoginTime fmt=ISO>})
   

Step 3: Set permissions so that our basic xmlrpc client can access the object.

Set the permissions so that Anonymous can View the sqlAddRow object.

Step 4: Call the function from an xmlrpc client in Python.

From C:\Program Files\Website\Lib\Python directory, type:

    C:\Program Files\Website\Lib\Python>C:\Progra~1\Website\Bin\Python.exe
    Python 1.5.2
    >>>from xmlrpclib import Server, DateTime
    >>>s=Server("http://localhost")
    >>>dict={}
    >>>dict['UserID']=teyc
    >>>dict['LastLoginTime']=DateTime()
    >>>s.sqlAddRow(dict)

Feedback

Feedback and comments? Write to me at [email protected].