Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Format of the initialization string does not conform to specification starting at index 0

Hi experts,

I have an addon that throws an error when I am trying to create a log table (Log4net). The error is : "Format of the initialization string does not conform to specification starting at index 0".

The connection string is: "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F0". Using SAP 9.1

Below is my app.config file:

<connectionStrings> 
    <add name="EIMCredit.DAL.Properties.Settings.SBODemoGBConnectionString"
        connectionString="Data Source=ACACIA;Initial Catalog=SBODEMOUS;Persist Security Info=True;User ID=sa;Password=tomcat22"
        providerName="System.Data.SqlClient" />

</connectionStrings>

Below is my code for inserting log table is non existent:

static void CreateLogTable(string logTableName, string connectionString)

        {

            using (SqlConnection sqlConnection = new SqlConnection(connectionString))  <------ Error is thrown here!

            {

                Server server = new Server(new ServerConnection(sqlConnection));

                // Create log table in database

                Database database = server.Databases[sqlConnection.Database];

                if (database == null)//check if database is null

                    return;

                if (!database.Tables.Contains(logTableName))

                {

                    // Create new table, called Log

                    Table newTable = new Table(database, logTableName);

                    // Add "Id" Column, which will be PK

                    Column idColumn = new Column(newTable, LogTableColumnName.Id.ToString());

                    idColumn.DataType = DataType.Int;

                    idColumn.Nullable = false;

                    idColumn.Identity = true;

                    idColumn.IdentitySeed = 1;

                    idColumn.IdentityIncrement = 1;

                    // Add "Date" Column

                    Column dateColumn = new Column(newTable, LogTableColumnName.Date.ToString());

                    dateColumn.DataType = DataType.DateTime;

                    dateColumn.Nullable = false;

                    // Add "Thread" Column

                    Column threadColumn = new Column(newTable, LogTableColumnName.Thread.ToString());

                    threadColumn.DataType = DataType.VarChar(255);

                    threadColumn.Nullable = false;

                    // Add "Level" Column

                    Column levelColumn = new Column(newTable, LogTableColumnName.Level.ToString());

                    levelColumn.DataType = DataType.VarChar(50);

                    levelColumn.Nullable = false;

                    // Add "Logger" Column

                    Column loggerColumn = new Column(newTable, LogTableColumnName.Logger.ToString());

                    loggerColumn.DataType = DataType.VarChar(255);

                    loggerColumn.Nullable = false;

                    // Add "Message" Column

                    Column messageColumn = new Column(newTable, LogTableColumnName.Message.ToString());

                    messageColumn.DataType = DataType.VarChar(4000);

                    messageColumn.Nullable = false;

                    // Add "Exception" Column

                    Column exceptionColumn = new Column(newTable, LogTableColumnName.Exception.ToString());

                    exceptionColumn.DataType = DataType.VarChar(2000);

                    exceptionColumn.Nullable = false;

                    // Add Columns to Table Object

                    newTable.Columns.Add(idColumn);

                    newTable.Columns.Add(dateColumn);

                    newTable.Columns.Add(threadColumn);

                    newTable.Columns.Add(levelColumn);

                    newTable.Columns.Add(loggerColumn);

                    newTable.Columns.Add(messageColumn);

                    newTable.Columns.Add(exceptionColumn);

                    // Create a PK Index for the table

                    Index index = new Index(newTable, "PK_Log");

                    index.IndexKeyType = IndexKeyType.DriPrimaryKey;

                    // The PK index will consist of 1 column, "Id"

                    index.IndexedColumns.Add(new IndexedColumn(index, LogTableColumnName.Id.ToString()));

                    // Add the new index to the table.

                    newTable.Indexes.Add(index);

                    // Physically create the table in the database

                    newTable.Create();

                }

            }

        }

What can I do to solve this?

Any help appreciated.

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question