Menu

O/S command line statements in scripts

Help
2008-04-21
2013-04-25
  • Mark Stevens

    Mark Stevens - 2008-04-21

    Can O/S command line statements be executed in scripts?
    Can a connection be made to a database without running an SQL query?

    Both of these questions are related to testing database connections.
    We currently have a a DOS batch file which tests that:
    sqlplus -S -L t/t@somedatabase | FIND "ORA-01017" > NUL
    IF not ERRORLEVEL 1 echo "Database OK..." ELSE echo "Problem with database..."

    ORA-01017 means invalid username/password
    Getting that error code means the server is responding and the database is listening and  responding.

    We would like to script a simlar test in Jameleon.
    Can that be done?

    Thanks,
    Mark

     
    • Christian Hargraves

      You will need to write a custom tag to support cmd line execution. This should be extremely easy to do.

      Maybe instead of scripting an invalid username and password and expecting an error back, you could login with a valid username/password and simply select count(*) from dual.

      You can specify "expectError='true'" on any function tag. However, this just verifies that an exception was thrown and not that it was the error you expected. I suppose I could add and "expectedExceptionType" or an "expectedErrorMsg".

      Basically, both of those could be done very easily with custom tags.

       

Log in to post a comment.