Loading ...

connect to oracle 10g (XE) from asp.net

Who is online?  0 guests and 1 members
home  »  forums   »  asp.net topics   »  data access   » connect to oracle 10g (XE) from asp.net

connect to oracle 10g (XE) from asp.net

Posts under the topic: connect to oracle 10g (XE) from asp.net

Posted: 7/30/2011

Lurker 5  points  Lurker
  • Joined on: 7/30/2011
  • Posts: 1

 

hello.
while long search and issues with connection to oracle database,i installed oracle database 10g express edition or XE,32 bits.
i have win 7 and 64bits machine.
so i tried to connect to this database after setting the ODBC driver (32 bits driver),but the problem is:
i successful connected from windows application,but failed from asp.net and i use the same code.
this is the error from asp.net:

  1. ERROR [NA000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-06413: Connection not open.
  2. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
  3. ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).

and i tried to connect from another laptop using win 7 32 bits,it worked from asp.net and windows application.
so i don't figure where is the error,and why it worked from windows application but it didn't from asp.net.
this is the code:

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data.Odbc;
  8. public partial class _Default : System.Web.UI.Page
  9. {
  10. protected void Page_Load(object sender, EventArgs e)
  11. {
  12. String con = "DRIVER={Microsoft ODBC for Oracle};DSN=XE;UID=hr;PWD=hr;SERVER=localhost;";
  13. OdbcConnection conx = new OdbcConnection(con);
  14. conx.Open();
  15. OdbcCommand command = new OdbcCommand("insert into test values('hi')", conx);
  16. command.ExecuteNonQuery();
  17.  
  18. conx.Close();
  19. }
  20. }

thank you very much.


Page 1 of 1 (1 items)