SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Guest

    Run .SQL file from silk test

    1) Can anybody tell me how to connect Oracle DB from silk?
    i.e. using DB_Connect (....)

    2) How to Run a SQL file but not a SQL statement only from silk:
    i.e. DB_ExecuteSql(...) can only execute a statement like "SELECT"... if I need run a c:\dbobject.sql from silk, how can I do that?

    ------------------
    RH
    rhuo@iname.com

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Location
    Des Moines, Iowa
    Posts
    289
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Run .SQL file from silk test

    I am not going to say that Silk can run every type of SQL statement but it has run very many for me.

    For the connect it would be very similar to any connect to a Oracle database using silk. Don't forget to add a DNS entry into the pc you are going to run silk from. The server, userid and password would all have to be known by you as well and passed in the connection string.

    As for the DBExecute statement. It seems to run what every you are able to get into a SQL statement string.

    One thought I have, is to turn that .SQL file into a stored proc on the Oracle system and then execute the proc with a SQL statement call from Silk in the DBExecute method. The execute statement will be in the same format as you would run in SQL Plus. That is generally how I do it with big complex statements like creating tables.

    Steven Blackwell
    Senior Testing Engineer
    NCSPearson
    (319) 354-9200 ext. 6026
    BlacSt@ncs.com

    ------------------

  3. #3
    Senior Member
    Join Date
    Jan 2002
    Location
    Des Moines, Iowa
    Posts
    289
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Run .SQL file from silk test

    RH,

    In reference to your message that you left. I am afraid that I can not initiate a outbound long distance call for non-business related purposes.

    If you want to call back between 2:00 PM and 4:00 PM Central US time I could spend a few minutes answering your calls

    Steven Blackwell
    Senior Testing Engineer
    NCSPearson
    (319) 354-9200 ext. 6026
    BlacSt@ncs.com

    ------------------

  4. #4
    Guest

    Re: Run .SQL file from silk test

    Thanks for all the helps, here is two way of doing it:
    1) [-] testcase RunSQLFileODBC()
    [ ]
    [ ] HDATABASE hdbconnect // DB connection handle
    [ ] HSQL hsqlexe //
    [ ] HFILE hSQLFile
    [ ]
    [ ] STRING sLine
    [ ] STRING sFilePath="c:\temp\"
    [ ] STRING sFileName="dbobjects.sql"
    [ ]
    [ ] // Connect to oracle DB throght win2k ODBC Oracle client
    [ ] hdbconnect = DB_Connect ("dsn=mydb;PWD=system;UID=manager")
    [ ]
    [-] hSQLFile = FileOpen (sFilePath+sFileName, FM_READ)
    [-] while (FileReadLine (hSQLFile, sLine))
    [ ] hsqlexe = DB_ExecuteSql (hdbconnect, sLine)
    [ ] FileClose (hSQLFile)
    [ ]
    [ ] // Release the resource
    [ ] DB_FinishSQL (hsqlexe)
    [ ]
    [ ] // disconnect
    [ ] DB_Disconnect (hdbconnect)

    2) [-] UtilsRunSQLFile (String sSqlFile, String sSqlFileDir, String sOracleBin)
    [ ] String sRunSQLCmd
    [ ] List of String lsSQLOutput
    [ ] String sPlusExe
    [ ]
    [-] if SYS_FileExists (sOracleBin+"\sqlplus.exe ")
    [ ] sPlusExe = "\sqlplus.exe "
    [ ]
    [-] if sPlusExe == NULL
    [ ] Print ("Can't find a SQLplus in Oracle home")
    [ ]
    [-] else
    [-] if (StrPos(".sql", sSqlFile) == 0)
    [ ] sRunSQLCmd = sOracleBin + sPlusExe + constDbaUsername+"/"+constDbaPassword+"@"+constDbaSchema+" @"+sSqlFileDir+"\"+sSqlFile+".sql"
    [-] else
    [ ] sRunSQLCmd = sOracleBin + sPlusExe + constDbaUsername+"/"+constDbaPassword+"@"+constDbaSchema+" @"+sSqlFileDir+"\"+sSqlFile
    [ ] SYS_Execute(sRunSQLCmd, lsSQLOutput)
    [ ] ListPrint(lsSQLOutput)

    ** 1) from me 2) from my co-worker

    ------------------
    RH
    rhuo@iname.com

  5. #5
    Super Member
    Join Date
    Jul 1999
    Location
    Rancho Santa Margarita, CA
    Posts
    1,439
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Run .SQL file from silk test

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by rhuo:
    2) How to Run a SQL file but not a SQL statement only from silk:
    i.e. DB_ExecuteSql(...) can only execute a statement like "SELECT"... if I need run a c:\dbobject.sql from silk, how can I do that?

    <HR></BLOCKQUOTE>

    Your number 2 solution is not really answering your own question (only from silk) since you are going thru sqlplus.
    Well, sure there's more ways to running your SQL file in SilkTest but via other SQL or DB Tools (SQLPlus for Windows is one of them) which is capable of loading/opening your .sql file and then choosing Execute or Run from their respective menus or pushbuttons. You may have to record window declarations for those other tools though.




    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:55 PM.

Copyright BetaSoft Inc.