Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data base connection problem
#1
Solved: 10 Years, 9 Months, 3 Weeks ago
I am having trouble with oracle database connection, how should I know my connection is success or not. When I run the script it is giving 0 failed result, any sample code is very helpful. Please check the below sample code

Code:
Dim OdbcDSN
Dim connect, sql, resultSet
Dim dbConn
Dim rsGetAccountData
Dim strSQL, strCategory, strCategoryType
Dim a1
On Error Resume Next
Public Sub SetDBConnection
   'Purpose:  Set the database connection
Set dbConn = CreateObject("ADODB.Connection")
dbConn.ConnectionString = "DSN=sys_qtp_ora;Server=test;Uid=username;Pwd=password;"
dbConn.Open
End Sub
Public Sub GetAccountData()
   Set resultSet = CreateObject ("ADODB.RecordSet")
   'Purpose:  Get the account data information from table
    strSQL = "select  first_name,last_name  from   names where rownum <10"
              '  strSQL = "insert into aaa values(1234)"
resultSet = dbConn.Execute(strSQL)
'MsgBox "Hello everyone!"
MsgBox "Not Connected" & resultSet
Do While Not resultSet.eof

If a1  = 10 then
   MsgBox "reddy" & resultSet("first_name")
        end if
resultSet.MoveNext
Loop
resultSet.Close

End Sub

Call SetDatabase()
Call GetAccountData()
Reply


Messages In This Thread
Data base connection problem - by Ashley - 07-16-2008, 09:01 PM
RE: Data base connection problem - by niranjan - 07-16-2008, 11:50 PM
RE: Data base connection problem - by Ashley - 07-17-2008, 08:30 PM
RE: Data base connection problem - by somisays - 07-17-2008, 09:55 PM
RE: Data base connection problem - by anemuday - 07-17-2008, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] Connection String for Oracle robertosalemi 6 11,736 01-15-2016, 04:51 PM
Last Post: robertosalemi
  DB2 Connect connection with IE 11 SRP 1 2,421 12-18-2015, 12:41 PM
Last Post: vinod123
  IBM DB2 connection with VB script bmurali 2 10,469 12-18-2015, 12:38 PM
Last Post: vinod123
  Connection with HP ALM hachem 0 2,416 02-26-2015, 04:36 PM
Last Post: hachem
  “Cannot connect to 8822 (connection timed out)" Ikbal 0 1,997 12-08-2014, 11:38 PM
Last Post: Ikbal

Forum Jump:


Users browsing this thread: 1 Guest(s)