![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Connecting to external database from dxl script Topic Summary: Created On: 2-Jan-2006 18:37 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I've seen a couple of threads on this topic but they were incomplete. Is it fairly easy to access an external database, say Oracle or Access, from a dxl script? Anyone have any examples? A project I'm looking at needs to read from a data warehouse and create modules, attritbutes, etc. in DOORS based upon the data. I'm just trying to think of the best ways to do this. I guess I could connect to DOORS via a stored proc or something but am thinking it might be easier to wrap everything in dxl if I can work with the database there.
Any ideas/suggestions are appreciated.
Thanks,
Mike
|
|
![]() |
|
![]() |
|
Hi Michael,
spontaneous I have three ideas for solving your problem : 1) export existing DB into CVS and use default DOORS inport function --> a DXL script could then create any needed links hierarchy etc. from this data 2) use OLE automation to run DXL code (may be in Excel or Access) 3) use DOORs DXL OLE automation to access ODBC driver in Excel, Access.... May be later, I will need soming like that too, but for now I haven't enough time to program it, sorry. ![]() Greetings Reik Schröder ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
Okay. Thanks for the suggestions and ideas.
|
|
![]() |
|
![]() |
|
By the way, if anyone has any experience doing as Reik describes in #3 (use DOORs DXL OLE automation to access ODBC driver in Excel, Access), I would love to see a simple example.
Thanks,
Mike
|
|
![]() |
|
![]() |
|
Hi Michael,
I've only used OLE automation export/import to/from Excel or Word, but not dealed with ODBC. I would suggest to you to try first to access a dabase from integreted VBA (in Access or Excel). Sometimes it is usefull to record a macro and have a look into generated VB code. If you have created a function in VBA, wich does, what you need, you can try to convert it into DOORS. An example of using OLE in DOORs is given in Telelogic\DOORS 7.1\lib\dxl\standard\export\office\excel.dxl It is very much esier, if you try it before in VBA, because there you have debuger, help file, etc. Good Luck! ![]() Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
Not sure if this is what you are looking for, but I found this piece of DXL code that connects to a MSAccess database from DOORS (have not tried it myself yet). I believe I found this code posted in this forum some time ago. It may help you get started.
OleAutoObj oConn OleAutoObj oRst string vCS int records = 0 int state = 0 int iRec = 0 string result = "" string sConn = "" string sValue1 = "" string sValue2 = "" OleAutoArgs objArgBlock1 = create OleAutoArgs objArgBlock2 = create vCS = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\DOORS.MDB" // path !!! oConn = oleCreateAutoObject("adodb.connection") oRst = oleCreateAutoObject("adodb.recordset") oFields = oleCreateAutoObject("adodb.fields") oField1 = oleCreateAutoObject("adodb.field") oField2 = oleCreateAutoObject("adodb.field") /* Connect to the database and open it */ olePut( oConn , "ConnectionString" , vCS ) oleMethod( oConn , "Open") oleGet( oConn , "ConnectionString" , sConn ) /* Attempt to open the record set */ olePut( oRst , "Source" , "Select * from DOORS" ) // SQL statement olePut( oRst , "CursorType" , 0 ) // 0 = forward cursor only olePut( oRst , "CursorLocation" , 3 ) // client cursor olePut( oRst , "Mode" , 1 ) // locking = readonly olePut( oRst , "ActiveConnection" , oConn ) // set connection oleMethod( oRst , "Open" ) oleGet( oRst , "State" , state ) if ( state == 1 ) print "Connection opened...\n"; oleGet( oRst , "RecordCount" , records ) print "Query returned " records " records\n"; oleMethod( oRst , "MoveFirst") oleGet( oRst, "Fields", oFields) put(objArgBlock1, "field01") // first field name oleMethod(oFields, "Item", objArgBlock1, oField1) put(objArgBlock2, "field02") // second field name oleMethod(oFields, "Item", objArgBlock2, oField2) for (x=1; x <= records; x+=1) { sValue1 = " " sValue2 = " " oleGet(oField1, "Value", sValue1 ) oleGet(oField2, "Value", sValue2 ) oleMethod( oRst , "MoveNext" ) print x "\t" iRec "\t" sValue1 " " sValue2 "\n" } delete(objArgBlock1) delete(objArgBlock2) oleMethod(oRst, "close"); // Close the record set oleMethod(oConn, "close"); // Close the connection ------------------------- Karen Hidalgo<BR>Northrop Grumman - TASC<BR>karen.hidalgo@ngc.com |
|
![]() |
|
![]() |
|
Thanks! Couldn't find the code in the forum. I was half way there already, but that bit of code worked perfectly, just change the connection string, the query, and field names and you're done.
Mike |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.