Connecting to Informix in .NET

Imports IBM.Data.Informix

Dim ifxConnection As IfxConnection = New IfxConnection

dbname   = "mydb"
dbserver = "ifx1"
dbhost   = "192.168.1.10"
dbuid    = "dbuser"
dbpwd    = "password"
dbproto  = "onsoctcp"
dbsvc    = "ifx1"

ifxConnection.ConnectionString = "database=" & dbname & ";" & _
				 "server=" & dbserver & ";" & _
				 "host=" & dbhost & ";" & _
				 "uid=" & dbuid & ";" & _
				 "pwd=" & dbpwd & ";" & _
				 "protocol=" & dbproto & ";" & _
				 "service=" & dbsvc & ";"

	Try
		ifxConnection.Open()
		Console.Write("Success!")
		ifxConnection.Close()
	Catch ex As Exception
		Console.Write("Error: " & ex.Message)
	End Try

Leave a Reply

Your email address will not be published. Required fields are marked *