question on Asp.net and Oracle

  • Thread starter SHAWN DEB ECKLEY
  • Start date
S

SHAWN DEB ECKLEY

Hi i'm wondering if anyone can tell me where i'm going wrong.
first off i'm using vb.net 2003 to access an oracle 9i (9.2.0.1)
i have created a class library that allows me to access an oracle database.
i have it working in conjunction with a desktop application. however when i
use it with a web application i continue to get error message saying that
"Could not create an environment: OCIEnvCreate returned -1"

I have then gone back and created a 'fileDSN' which uses the Oracle client
to access the database. i then connected the class library to the fileDSN
and used it in the affore mentioned desktop app. it returned the data in a
split second. then next step i took was to use the library in the web
application. i then ran it. when it goes to connect to the database it seems
to hang. after 10 minute it had not a thing.

anyone have any ideas.
thanks
 
D

David Browne

SHAWN DEB ECKLEY said:
Hi i'm wondering if anyone can tell me where i'm going wrong.
first off i'm using vb.net 2003 to access an oracle 9i (9.2.0.1)
i have created a class library that allows me to access an oracle database.
i have it working in conjunction with a desktop application. however when i
use it with a web application i continue to get error message saying that
"Could not create an environment: OCIEnvCreate returned -1"

I have then gone back and created a 'fileDSN' which uses the Oracle client
to access the database. i then connected the class library to the fileDSN
and used it in the affore mentioned desktop app. it returned the data in a
split second. then next step i took was to use the library in the web
application. i then ran it. when it goes to connect to the database it seems
to hang. after 10 minute it had not a thing.

The OracleClient is a bunch of DLL's in the [ORACLE HOME]\BIN directory.
The identity running your web app must have access to the [ORACLE HOME], and
[ORACLE HOME]\bin must be in the path. If you installed the OracleClient
since your last reboot, you will need to reboot for services to see this
change.

David
 
S

SHAWN DEB ECKLEY

I have already reboot the machine since i nstalled the oracle client. i have
even made sure the oracle home is in PATH. and i t still doesn't work.

David Browne said:
SHAWN DEB ECKLEY said:
Hi i'm wondering if anyone can tell me where i'm going wrong.
first off i'm using vb.net 2003 to access an oracle 9i (9.2.0.1)
i have created a class library that allows me to access an oracle database.
i have it working in conjunction with a desktop application. however
when
i
use it with a web application i continue to get error message saying that
"Could not create an environment: OCIEnvCreate returned -1"

I have then gone back and created a 'fileDSN' which uses the Oracle client
to access the database. i then connected the class library to the fileDSN
and used it in the affore mentioned desktop app. it returned the data in a
split second. then next step i took was to use the library in the web
application. i then ran it. when it goes to connect to the database it seems
to hang. after 10 minute it had not a thing.

The OracleClient is a bunch of DLL's in the [ORACLE HOME]\BIN directory.
The identity running your web app must have access to the [ORACLE HOME], and
[ORACLE HOME]\bin must be in the path. If you installed the OracleClient
since your last reboot, you will need to reboot for services to see this
change.

David
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

What library are you using? OracleClient?

1. Do you have access to OraHome?
2. Do you have TNS names set up for your database?

If the answer to either question is no, you have to correct it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
S

SHAWN DEB ECKLEY

I have access to Oracle home, it is in my PATH variable and the db is in my
TNSNAME.ora file.
i have tried using:
System.Data.OleDb

System.Data.OracleClient

Oracle.DataAccess.Client

none have worked
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

Are you able to connect with SQL* Plus?

As an aside, I like the ODP.NET (from Oracle) better than the OracleClient,
especially with 9i or newer.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
S

SHAWN DEB ECKLEY

yes i can connect with sql* plus. the ODP.NET. i looked through my oracle
directory and found some samples. it seems i'm doing something familiar to
what they do.

dbTools.vb ************

Imports System.IO
Imports System.Windows.Forms
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class dbTools
Private conn As OracleConnection
Public rdr As OracleDataReader
Private cmd As OracleCommand
Private dptr As OracleDataAdapter
Public sqlText As String
Public Sub New()

conn = New OracleConnection
cmd = New OracleCommand
dptr = New OracleDataAdapter
End Sub
Private Sub openConnection()
ConnectionParams.setparams()
Dim connectionString As String = "Data Source=" +
ConnectionParams.datasource & _
";User ID=" + ConnectionParams.username & _
";Password=" + ConnectionParams.password
conn.ConnectionString = connectionString
Try
conn.Open()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " & _
ex.Message.ToString, "warning", MessageBoxButtons.OK, MessageBoxIcon.Error,
_
MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
End Try
End Sub
Public Sub closeConnection()
conn.Close()
End Sub
Public Sub executeQuery(ByRef myHash As Hashtable)
openConnection()
cmd.Connection = conn
cmd.CommandText = sqlText
rdr = cmd.ExecuteReader()
While (rdr.Read())
myHash.Add(rdr.GetInt32(1), rdr.GetString(0))
End While
closeConnection()
End Sub
End Class

and Connections.params


Module ConnectionParams
Public datasource As String
Public username As String
Public password As String
Public Sub setparams()
datasource = "xxxxxxxxx"
'Username
username = "xxxxxxxx"
'Password
password = "xxxxxx"
End Sub
End Module

and the code that calls the dbTools

Dim key As String
myDB.sqlText = "select * from VW_DISP_CAMPAIGN_NAME"
myDB.executeQuery(myHash)
myDB.closeConnection()
For Each key In myHash.Keys
Me.lstbxCampaignName.Items.Add(key)
Next


it attempts to open the connection and blows up. i'm wondering if it might
have to deal with the fact that both the web server and the oracle database
are on the same machine?
i'm stuck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top