I have a small program which execute ftp command to retrieve csv file from machine and read the csv file and store information to the database.
I face a problem where I keep on getting error message
System.Data.OleDb.OleDbException (0x80004005): ORA-12170: TNS:Connect timeout occurred System.Data.OleDb.OleDbException (0x80004005): ORA-12170: TNS:Connect timeout occurred at GetPLCData_P1M1.ConnectOracle_NoUse.OpenConn() in
C:\Users\shaari\Desktop\Workspace\Current\Midware\GetData_Mitsubishi\GetPLCData\GetPLCData\ConnectOracle_NoUse.vb:line 30 at GetPLCData_P1M1.Form1.GetTableStructure(String mTableName) in C:\Users\shaari\Desktop\Workspace\Current\Midware\GetData_Mitsubishi\GetPLCData\GetPLCData\Form1.vb:line 1449
I had this program in 3 PC.. The other 2 PC does not have this problem. Only 1 PC got this problem, while I am using the same setting for all program. The only difference is on the machine name and category. The other 2 PC that having this program only have 1 program running each, while this special PC having 2 program of this running. Sorry for my bad English.. Meaning to say is I have a total of 4 machine which is A, B, C, and D. Program A is for fetch the data in Machine A and this program run in PC A. Program B is for fetch the data in Machine B and this program run in PC B. Program C is for fetch the data in Machine C and this program run in PC C. Program D is for fetch the data in Machine D and this program run in PC C. Note that PC C is having 2 program running, which is Program C and D. Is this is what causing the TNS timeout to occured? Please advice me to solve this issue guys. I had spending like 1 month on this issue but still failed to find a logic explanation on why is occur. If this is the case. Please advice me also where can I check again in order to solve this issue.
OracleConnectionString = "Provider=OraOLEDB.Oracle.1;User ID=user;Data Source=source;Password=pass" 'This line inside the app setting file
Code
Public Function GetTableStructure(mTableName As String) As DataTable
Try
Dim dt As DataTable = New DataTable
Dim pstruct As String = "Select * from " & mTableName & " where 1 = 2 "
Dim Addap As OleDbDataAdapter
OracleConnString As String = ConfigurationSettings.AppSettings("OracleConnectionString")
OpenConn()
ds.Clear()
ds.Tables.Clear()
Addap = New OleDbDataAdapter(pstruct, strCon)
Addap.Fill(ds, "PLC_Realtime_Log")
dt = ds.Tables("PLC_Realtime_Log")
Return dt
Catch ex As Exception
Trace.WriteLine(ex.ToString)
Return Nothing
End Try
End Function
User contributions licensed under CC BY-SA 3.0