Posted: 7/30/2011
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:
ERROR [NA000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-06413: Connection not open.ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failedERROR [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:
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data.Odbc;public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { String con = "DRIVER={Microsoft ODBC for Oracle};DSN=XE;UID=hr;PWD=hr;SERVER=localhost;"; OdbcConnection conx = new OdbcConnection(con); conx.Open(); OdbcCommand command = new OdbcCommand("insert into test values('hi')", conx); command.ExecuteNonQuery(); conx.Close(); }}
thank you very much.