1*cdf0e10cSrcweirimport uno 2*cdf0e10cSrcweir 3*cdf0e10cSrcweirfrom com.sun.star.sdb.CommandType import COMMAND 4*cdf0e10cSrcweir 5*cdf0e10cSrcweirdef main(): 6*cdf0e10cSrcweir 7*cdf0e10cSrcweir connectionString = "socket,host=localhost,port=2002" 8*cdf0e10cSrcweir 9*cdf0e10cSrcweir url = "uno:"+connectionString + ";urp;StarOffice.ComponentContext" 10*cdf0e10cSrcweir 11*cdf0e10cSrcweir localCtx = uno.getComponentContext() 12*cdf0e10cSrcweir localSmgr = localCtx.ServiceManager 13*cdf0e10cSrcweir resolver = localSmgr.createInstanceWithContext( 14*cdf0e10cSrcweir "com.sun.star.bridge.UnoUrlResolver", localCtx) 15*cdf0e10cSrcweir ctx = resolver.resolve( url ) 16*cdf0e10cSrcweir smgr = ctx.ServiceManager 17*cdf0e10cSrcweir 18*cdf0e10cSrcweir rowset =smgr.createInstanceWithContext( "com.sun.star.sdb.RowSet", ctx ) 19*cdf0e10cSrcweir rowset.DataSourceName = "Bibliography" 20*cdf0e10cSrcweir rowset.CommandType = COMMAND 21*cdf0e10cSrcweir rowset.Command = "SELECT IDENTIFIER, AUTHOR FROM biblio" 22*cdf0e10cSrcweir 23*cdf0e10cSrcweir rowset.execute(); 24*cdf0e10cSrcweir 25*cdf0e10cSrcweir print "Identifier\tAuthor" 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir id = rowset.findColumn( "IDENTIFIER" ) 28*cdf0e10cSrcweir author = rowset.findColumn( "AUTHOR" ) 29*cdf0e10cSrcweir while rowset.next(): 30*cdf0e10cSrcweir print rowset.getString( id ) + "\t" + repr( rowset.getString( author ) ) 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir rowset.dispose(); 34*cdf0e10cSrcweir 35*cdf0e10cSrcweirmain() 36