ImportX12

Apr 25, 2013 at 11:59 PM
Can't thank you enough for all the work you have put into this Parser and all of the help you have provided us with on the forums.

I am looking forward to getting the program to parse directly into our SQL server but am coming across some difficulties getting it to work. Below is the text from the error log and the connection string that I have set up within the code.
oopfactory.x12.importx12.exe Error: 0 : Error parsing G:\Temp\Inbound\020620A0.RMT: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at OopFactory.X12.Repositories.DbCreation`1.ExecuteScalar(SqlCommand cmd)
   at OopFactory.X12.Repositories.DbCreation`1.TableExists(String tableName)
   at OopFactory.X12.Repositories.SqlTransactionRepository`1.EnsureSchema()
   at OopFactory.X12.Repositories.SqlTransactionRepository`1.Save(Interchange interchange, String filename, String userName)
   at OopFactory.X12.ImportX12.Program.Main(String[] args)
   DateTime=2013-04-25T22:54:04.2282781Z
oopfactory.x12.importx12.exe Error: 0 : Error parsing G:\Temp\Inbound\020620A1.RMT: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at OopFactory.X12.Repositories.DbCreation`1.ExecuteScalar(SqlCommand cmd)
   at OopFactory.X12.Repositories.DbCreation`1.TableExists(String tableName)
   at OopFactory.X12.Repositories.SqlTransactionRepository`1.EnsureSchema()
   at OopFactory.X12.Repositories.SqlTransactionRepository`1.Save(Interchange interchange, String filename, String userName)
   at OopFactory.X12.ImportX12.Program.Main(String[] args)
   DateTime=2013-04-25T22:54:04.2438790Z
 <connectionStrings>
    <add name="X12" connectionString="Data Source=10.20.1.246\SQL;Initial Catalog=TestnoIndexes;Integrated Security=True"/>
  </connectionStrings>
Any help you can provide would be appreciated.

Thanks!
Coordinator
Apr 26, 2013 at 1:35 AM
It looks like it can't find this resource.
You need to change the "Initial Catalog" from TestnoIndexes to the name of your empty database.
You also need to make sure your SQL Server instance can allow remote connections.
Since you are using Integrated Security=True you will need to make sure your windows login has permission to create objects in your database. Probably dbowner for just trying out the ImportX12.

The released versions don't create any schemas for you so make sure your Schema settings are all "dbo" or that you create your schemas before the import.