Пример #1
0
        public void Execute_InvalidBackupServerCommand_ThrowsAseException_Sap()
        {
            using (var connection = new Sybase.Data.AseClient.AseConnection(ConnectionStrings.Pooled))
            {
                var dbName = connection.QuerySingle <string>("select db_name()");

                var ex = Assert.Throws <Sybase.Data.AseClient.AseException>(() => connection.Execute($"dump database {dbName} to '/doesnotexist/foo' with compression = '101'"));
                Assert.Greater(ex.Errors.Count, 1);
                Assert.Greater(ex.Errors[0].Severity, 10);
            }
        }
Пример #2
0
 public SybaseASE()
 {
     Console.WriteLine("Creating Sybase.Data.AseClient.AseConnectionObject");
     try
     {
         var obj = new Sybase.Data.AseClient.AseConnection();
         Console.WriteLine("SUCCESS!");
     }
     catch (Exception ex)
     {
         Console.WriteLine("FAILED");
         Console.WriteLine(ex.Message);
     }
 }
Пример #3
0
 public IDbConnection CreateConnection()
 {
     IDbConnection conn = null;
     if (ClientType.ctMsSql == DbType)
     {
         conn = new SqlConnection(ConnectionString);
     }
     else if (ClientType.ctOleDB == DbType)
     {
         conn = new OleDbConnection(ConnectionString);
     }
     else if (ClientType.ctOracle == DbType)
     {
         conn = new OracleConnection(ConnectionString);
         if (conn.State == ConnectionState.Closed) conn.Open();
         OracleTransaction tran = conn.BeginTransaction(IsolationLevel.Unspecified) as OracleTransaction;
         tran.Commit();
         conn.Close();
     }
     else if (ClientType.ctODBC == DbType)
     {
         conn = new OdbcConnection(ConnectionString);
     }
     #if MySql
     else if (ClientType.ctMySql == DbType)
     {
         conn = new MySql.Data.MySqlClient.MySqlConnection(ConnectionString);
     }
     #endif
     #if Informix
     else if (ClientType.ctInformix == DbType)
     {
         conn = new IBM.Data.Informix.IfxConnection(ConnectionString);
         if (conn.State == ConnectionState.Closed) conn.Open();
         var command = conn.CreateCommand();
         command.CommandText = "EXECUTE PROCEDURE ifx_allow_newline ('t')";
         command.ExecuteNonQuery();
     }
     #endif
     #if Sybase
     else if (ClientType.ctSybase == DbType)
     {
         conn = new Sybase.Data.AseClient.AseConnection(ConnectionString);
     }
     #endif
     else
     {
         throw new EEPException(EEPException.ExceptionType.MethodNotSupported, this.GetType(), null, "CreateConnection", null);
     }
     return conn;
 }