Thursday, March 22, 2012

OleDbConnection Good, SQLConnection Bad?

This Exception is executed when using SQLConnection.
OleDbConnection connects fine.

[FileNotFoundException: The specified module could not be found.]
System.EnterpriseServices.Platform.Initialize() +503
System.EnterpriseServices.ResourcePool..ctor(Trans actionEndDelegate cb)
+11
System.Data.SqlClient.ConnectionPool..ctor(Default PoolControl ctrl) +797
System.Data.SqlClient.PoolManager.FindOrCreatePool (DefaultPoolControl
ctrl) +170

System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) +358
System.Data.SqlClient.SqlConnection.Open() +384
component_net.test.GetSingleValueStringX(String sTable, String
sFieldToGet, String sFieldToFind, String sValueToFind)
component_net.test.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731Usually it just works ;-)

The few lines surrounding the call raising this exception would help. My
wild wild guess would be a connection string issue.

Patrice

--

"Ludvig" <gjermund@.fastpublish.no> a crit dans le message de
news:0e6kd.246$72.180217856@.news.telia.no...
> This Exception is executed when using SQLConnection.
> OleDbConnection connects fine.
> [FileNotFoundException: The specified module could not be found.]
> System.EnterpriseServices.Platform.Initialize() +503
> System.EnterpriseServices.ResourcePool..ctor(Trans actionEndDelegate cb)
> +11
> System.Data.SqlClient.ConnectionPool..ctor(Default PoolControl ctrl)
+797
> System.Data.SqlClient.PoolManager.FindOrCreatePool (DefaultPoolControl
> ctrl) +170
>
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> tionString options, Boolean& isInTransaction) +358
> System.Data.SqlClient.SqlConnection.Open() +384
> component_net.test.GetSingleValueStringX(String sTable, String
> sFieldToGet, String sFieldToFind, String sValueToFind)
> component_net.test.Page_Load(Object sender, EventArgs e)
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +731
Thanks for your replay.
SQLConnection works on our develop machine.
This problem occurred after a hacker attack on our public server.
After reinstalling the framework, everything seems to be ok, except
SQLConnection.
To track this problem down, I tried to connect with OleDbConnection instead,
and that did work.
Maybe there is a corrupt DLL or something.
I just can't figure out what to do to solve this problem, based on the
"Stack Trace"

--------
The SQLConnection issue commented out...

'conString = ("server=MyServer;uid=USER;pwd=pass;database=MyDB")
conString = ("Provider=SQLOLEDB;data
source=MyServer;database=MyDB;uid=USER;pwd=pass")

Dim XstrSQL As String = "SELECT * FROM users WHERE User_ID=1"

Dim conO As New OleDb.OleDbConnection(conString)
Dim conC As New OleDb.OleDbCommand(XstrSQL, conO)

Try

conO.Open()
Dim conDR As OleDb.OleDbDataReader
conDR = conC.ExecuteReader(CommandBehavior.CloseConnection )
While conDR.Read()
Test = conDR("User_Name")
End While

Response.Write(Test)

Catch sx As System.IO.FileNotFoundException
Response.Write(sx.StackTrace & "<br><br>" & sx.Message)
End Try

'Dim XscnnNW As New SqlConnection(conString)
'Dim Xscmd As New SqlCommand(XstrSQL, XscnnNW)
'Dim XobjDR As SqlDataReader

'Try

'XscnnNW.Open()
'XobjDR = Xscmd.ExecuteReader(CommandBehavior.CloseConnectio n)
'While XobjDR.Read()
'Test = XobjDR("User_Name")
'End While

'Catch sx As System.IO.FileNotFoundException
Response.Write(sx.StackTrace & "<br><br>" & sx.Message)
'Finally
'Xscmd.Dispose()
'XscnnNW.Dispose()
'End Try

"Patrice" <nobody@.nowhere.com> skrev i melding
news:O7sF2HoxEHA.3808@.TK2MSFTNGP15.phx.gbl...
> Usually it just works ;-)
> The few lines surrounding the call raising this exception would help. My
> wild wild guess would be a connection string issue.
> Patrice
> --
> "Ludvig" <gjermund@.fastpublish.no> a crit dans le message de
> news:0e6kd.246$72.180217856@.news.telia.no...
> > This Exception is executed when using SQLConnection.
> > OleDbConnection connects fine.
> > [FileNotFoundException: The specified module could not be found.]
> > System.EnterpriseServices.Platform.Initialize() +503
> > System.EnterpriseServices.ResourcePool..ctor(Trans actionEndDelegate
cb)
> > +11
> > System.Data.SqlClient.ConnectionPool..ctor(Default PoolControl ctrl)
> +797
> > System.Data.SqlClient.PoolManager.FindOrCreatePool (DefaultPoolControl
> > ctrl) +170
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> > tionString options, Boolean& isInTransaction) +358
> > System.Data.SqlClient.SqlConnection.Open() +384
> > component_net.test.GetSingleValueStringX(String sTable, String
> > sFieldToGet, String sFieldToFind, String sValueToFind)
> > component_net.test.Page_Load(Object sender, EventArgs e)
> > System.Web.UI.Control.OnLoad(EventArgs e) +67
> > System.Web.UI.Control.LoadRecursive() +35
> > System.Web.UI.Page.ProcessRequestMain() +731
After couple of hours assembly language debugging, figured out that it throws
that exception because a call to native Win32 API LoadLibraryW was failing.
The LoadLibraryW was trying to load \WINNT\SYSTEM32\COM\comadmin.dll. Once
I copied that DLL from another system, it worked like a charm.

Hope this helps others.

P

"Ludvig" wrote:

> Thanks for your replay.
> SQLConnection works on our develop machine.
> This problem occurred after a hacker attack on our public server.
> After reinstalling the framework, everything seems to be ok, except
> SQLConnection.
> To track this problem down, I tried to connect with OleDbConnection instead,
> and that did work.
> Maybe there is a corrupt DLL or something.
> I just can't figure out what to do to solve this problem, based on the
> "Stack Trace"
>
> --------
> The SQLConnection issue commented out...
>
> 'conString = ("server=MyServer;uid=USER;pwd=pass;database=MyDB")
> conString = ("Provider=SQLOLEDB;data
> source=MyServer;database=MyDB;uid=USER;pwd=pass")
>
> Dim XstrSQL As String = "SELECT * FROM users WHERE User_ID=1"
> Dim conO As New OleDb.OleDbConnection(conString)
> Dim conC As New OleDb.OleDbCommand(XstrSQL, conO)
> Try
> conO.Open()
> Dim conDR As OleDb.OleDbDataReader
> conDR = conC.ExecuteReader(CommandBehavior.CloseConnection )
> While conDR.Read()
> Test = conDR("User_Name")
> End While
> Response.Write(Test)
> Catch sx As System.IO.FileNotFoundException
> Response.Write(sx.StackTrace & "<br><br>" & sx.Message)
> End Try
>
> 'Dim XscnnNW As New SqlConnection(conString)
> 'Dim Xscmd As New SqlCommand(XstrSQL, XscnnNW)
> 'Dim XobjDR As SqlDataReader
> 'Try
> 'XscnnNW.Open()
> 'XobjDR = Xscmd.ExecuteReader(CommandBehavior.CloseConnectio n)
> 'While XobjDR.Read()
> 'Test = XobjDR("User_Name")
> 'End While
> 'Catch sx As System.IO.FileNotFoundException
> Response.Write(sx.StackTrace & "<br><br>" & sx.Message)
> 'Finally
> 'Xscmd.Dispose()
> 'XscnnNW.Dispose()
> 'End Try
>
> "Patrice" <nobody@.nowhere.com> skrev i melding
> news:O7sF2HoxEHA.3808@.TK2MSFTNGP15.phx.gbl...
> > Usually it just works ;-)
> > The few lines surrounding the call raising this exception would help. My
> > wild wild guess would be a connection string issue.
> > Patrice
> > --
> > "Ludvig" <gjermund@.fastpublish.no> a écrit dans le message de
> > news:0e6kd.246$72.180217856@.news.telia.no...
> > > This Exception is executed when using SQLConnection.
> > > OleDbConnection connects fine.
> > > > [FileNotFoundException: The specified module could not be found.]
> > > System.EnterpriseServices.Platform.Initialize() +503
> > > System.EnterpriseServices.ResourcePool..ctor(Trans actionEndDelegate
> cb)
> > > +11
> > > System.Data.SqlClient.ConnectionPool..ctor(Default PoolControl ctrl)
> > +797
> > > System.Data.SqlClient.PoolManager.FindOrCreatePool (DefaultPoolControl
> > > ctrl) +170
> > > System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
> > > tionString options, Boolean& isInTransaction) +358
> > > System.Data.SqlClient.SqlConnection.Open() +384
> > > component_net.test.GetSingleValueStringX(String sTable, String
> > > sFieldToGet, String sFieldToFind, String sValueToFind)
> > > component_net.test.Page_Load(Object sender, EventArgs e)
> > > System.Web.UI.Control.OnLoad(EventArgs e) +67
> > > System.Web.UI.Control.LoadRecursive() +35
> > > System.Web.UI.Page.ProcessRequestMain() +731
> > > >

0 comments:

Post a Comment