By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,021 Members | 952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,021 IT Pros & Developers. It's quick & easy.

Connecting to PostgreSQL through SSH (putty)

100+
P: 111
Hii all,

im doin a vb 1.1 vs.net 2003 project where im trying to update the data from mysql to postgreSQL....

when im trying to click on update , im opening the connection of PostgreSQL using SSH(secure shell)
Expand|Select|Wrap|Line Numbers
  1. Dim myPgrConnect As New NpgsqlConnection("Server=localhost; Port=8443; Database=dalitch_css; User Id=dalitch; Password=dfndev; Timeout=30")
  2.         Dim myPgrCommand As New NpgsqlCommand
  3.         Dim strSQL As String
  4.         Dim record As String
  5.         Dim intRowsAffected As Integer
  6.         Dim ds As New DataSet
  7.         Dim myTable As DataTable
  8.  
  9.         myPgrConnect.Open()..........>> Here im getting a error stating that 
  10.  
An unhandled exception of type 'System.IO.IOException' occurred in npgsql.dll
Additional information: Unable to read data from the transport connection.

plz help.....

regards
ruth
May 23 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 534
You said "... opening the connection of PostgreSQL using SSH(secure shell)"
This suggests that database server is installed on a remote machine.
At the same time you coded "Server=localhost;"

I am not familiar with the VB/npgsql API, but this is the first thing I would check on. While at it verify that dbname, port# and everything else in the connect string is correct.

Also make sure that your version of npgsql is compatible with your version of Postgres.
(I think the latest Frontend/Backend Protocol is now up to version 3)

There's also a chance that this is a bug in npgsql, similar cases have been reported:
http://gborg.postgresql.org/project/...pdate.php?1418
May 24 '07 #2

100+
P: 111
You said "... opening the connection of PostgreSQL using SSH(secure shell)"
This suggests that database server is installed on a remote machine.
At the same time you coded "Server=localhost;"

I am not familiar with the VB/npgsql API, but this is the first thing I would check on.

Also make sure that your version of npgsql is compatible with your version of Postgres.
(I think the latest Frontend/Backend Protocol is now up to version 3)

Thnq for ur reply....

hey ure right...

Expand|Select|Wrap|Line Numbers
  1.         ' code to update the data with required fields into the post gre data base 
  2.         Dim myPgrConnect As New NpgsqlConnection
  3.         Dim myPgrCommand As New NpgsqlCommand
  4.               Dim strSQL As String
  5.         Dim record As String
  6.         Dim intRowsAffected As Integer
  7.         Dim ds As New DataSet
  8.         Dim myTable As DataTable
  9.  
  10.         Try
  11.             If Plink.HasExited = False Then
  12.                 myPgrConnect.ConnectionString = "Server=192.168.1.61; Port=5432; Database=dalitch_css; Userid=dalitch; Password=dfndev; Protocol=3; SSL=false; Pooling=true; MinPoolSize=1; MaxPoolSize=20; Encoding=UNICODE; Timeout=15; SslMode=Disable;"
  13.                 myPgrConnect.Open()
  14.             End If
  15.         Catch ex As Exception
  16.             MsgBox("Error" + ex.Message(), MsgBoxStyle.Information, "error")
  17.  
  18.             MessageBox.Show("Secure Shell is not connected", "Error Message...!!")
  19.             Return
  20.         Catch ex1 As System.NullReferenceException
  21.             MessageBox.Show("Error2: " + ex1.Message(), "Error Message...!!")
  22.             Return
  23.         End Try
  24.  
  25.         myTable = myData.Tables(0)
  26.         Dim myRow As DataRow
  27.  
  28.         'For Each myRow In mytable.Rows
  29.         '    strSQL = "UPDATE ""Tbl_Students"" SET " _
  30.         '    & " ""ST_FirstName"" = @ST_FirstName," _
  31.         '    & " ""ST_DateofBirth"" = @ST_DateofBirth, " _
  32.         '    & " ""ST_Gender"" = @ST_Gender, " _
  33.  
May 24 '07 #3

Expert 100+
P: 534
I'm glad it worked for you.
Please make sure to use the correct format (especially CODE TAGS) in your next posting.
The Posting Guidelines at the top of the forum will give you more information.
May 24 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.