Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Connection Timeout Expire after set connection.ConnectTimeout = 0

ankitkshahankitkshah Posts: 5Member

I have database with 22.5 GB size. My database is filestream enable database. My database mdf and ldf file size is 113 MB but my file stream data folder is 22 gb size. I take backup using following code and I get connection time out error..

Dim connection As New ServerConnection(sqlInstanceName, "sa", pwd)
Dim srv As Server
srv = New Server(connection)
connection.ConnectTimeout = 0
Dim db As Database
db = srv.Databases(DBName)
Dim recoverymod As Integer
recoverymod = db.DatabaseOptions.RecoveryModel
bk.Action = BackupActionType.Database
bk.Database = DBName
Dim str As String
str = full_path & ".bak"
Dim bdi As BackupDeviceItem
bdi = New BackupDeviceItem(str, DeviceType.File)
bk.Incremental = False

But after executing this it gives me error as following

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The backup or restore was aborted.
Processed 65328 pages for database 'abc', file 'abc' on file 1.
10 percent processed.
20 percent processed.
30 percent processed.
40 percent processed.
50 percent processed.
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv)

It works fine on small size database.. But not work on this 13 GB database.. I continuously see the backup file size. It created up to 8 GB but when after 8 GB it vanished. I have file stream enable database.

What is the problem after set connection timeout to 0?
Sign In or Register to comment.