Oracle and ASP connection

Oracle and ASP connection

am 16.02.2005 11:32:46 von suyog.shah

hi all,
i am trying to connect to oracle thru an ASP page ... for this i
write a code as below
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "dsn=OracleDSN;uid=userid;pwd=password;"

after this i am trying to display the rows of a table in the database

The problem is when i tried to run the ASP page on my comp which has
IIS 5.0 on it it gave me an error saying Oracle Client required but i
have Oracle Client on my system.
on second time onwards i didnot get this error at all neither i could
see something on the page (which actually should display rows) i am
getting wht is problem and wht is solution for this .

Plz help .........

Re: Oracle and ASP connection

am 16.02.2005 12:06:03 von McKirahan

"asp_ora" wrote in message
news:5295a58c.0502160232.22426abd@posting.google.com...
> hi all,
> i am trying to connect to oracle thru an ASP page ... for this i
> write a code as below
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "dsn=OracleDSN;uid=userid;pwd=password;"
>
> after this i am trying to display the rows of a table in the database
>
> The problem is when i tried to run the ASP page on my comp which has
> IIS 5.0 on it it gave me an error saying Oracle Client required but i
> have Oracle Client on my system.
> on second time onwards i didnot get this error at all neither i could
> see something on the page (which actually should display rows) i am
> getting wht is problem and wht is solution for this .
>
> Plz help .........

I suspect that:

objConn.Open "dsn=OracleDSN;uid=userid;pwd=password;"

should be changed to:

objConn.Open Driver={Microsoft ODBC for
Oracle;Server=OracleServer.world;uid=userid;pwd=password;"

http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNL ess.htm#ODBCDriv
erForOracleFromMicrosoft

Re: Oracle and ASP connection

am 16.02.2005 12:28:00 von suyog_linux

Thnx for help sir,

but unfortunately even this also is not working.


suyog

Re: Oracle and ASP connection

am 16.02.2005 12:28:05 von suyog_linux

Thnx for help sir,

but unfortunately even this also is not working.


suyog

RE: Oracle and ASP connection

am 16.02.2005 13:27:01 von JohnBeschler

The first thing I would do is make sure your connection object is actually
open. After the objConn.Open add:
Response.Write objConn.State
Response.End

You should see a "1" if the connection was succesful.

If that works, then move on to troubleshooting the data retrieval part of
your code.
If not, you need to verify your connection string properties. You might
also want to veryify that you can retrieve data using this DSN via some other
tool such as Excel.
You might also check out: http://gpoulose.home.att.net/ He has a free query
tool that works with most any ODNC driver. If you can connect to Oracle
using your ODBC connection with his tool, you should be able to connect
within IIS.





"asp_ora" wrote:

> hi all,
> i am trying to connect to oracle thru an ASP page ... for this i
> write a code as below
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "dsn=OracleDSN;uid=userid;pwd=password;"
>
> after this i am trying to display the rows of a table in the database
>
> The problem is when i tried to run the ASP page on my comp which has
> IIS 5.0 on it it gave me an error saying Oracle Client required but i
> have Oracle Client on my system.
> on second time onwards i didnot get this error at all neither i could
> see something on the page (which actually should display rows) i am
> getting wht is problem and wht is solution for this .
>
> Plz help .........
>

Re: Oracle and ASP connection

am 16.02.2005 14:05:17 von suyog_linux

hello sir,

i tried your options but unfortunatley again nothing comes on screen
even tht
Response.Write objConn.State
Response.End
does not print anything on the screen.

suyog

Re: Oracle and ASP connection

am 16.02.2005 14:11:02 von JohnBeschler

Can you post the entire contents of the page in question?



"suyog_linux" wrote:

> hello sir,
>
> i tried your options but unfortunatley again nothing comes on screen
> even tht
> Response.Write objConn.State
> Response.End
> does not print anything on the screen.
>
> suyog
>
>

Re: Oracle and ASP connection

am 16.02.2005 14:19:28 von suyog_linux

<%@ Language=VBScript %>
<% Option Explicit %>






Data form for post frame







<%

Dim oConnect
Dim oMap
Dim bInitSuccess
Dim oLayers
Dim xMin, yMin
Dim xMax, yMax
Dim mapClickX, mapClickY
Dim IDx, IDy, sIDx, sIDy
Dim sMapAction
Dim oExtent
Dim sMapURL, sLegURL
Dim oDBConn, oRecSet, bConnOpen
Dim sExtFeatures
Dim sIDAttributes
Dim sDBID, sActionTemp, sZoomToID
Dim sUser, bLoggedIn
Dim bCreateNewMap

bConnOpen = False ' DB connection not open yet
bCreateNewMap = True ' Make new map unless turn off
sMapAction = Request.Form("mapAction")

' Server & Map connection
Set oConnect = CreateObject("aims.ArcIMSConnector")
oConnect.ServerName = MAPSERVER
oConnect.ServerPort = CLng(MAPPORT)
Set oMap = CreateObject("aims.Map")
oMap.MapDraw = False
oMap.Legend.Display = False
oMap.Legend.Height = MAPHEIGHT
oMap.Legend.Title = " "
oMap.Legend.Width = 130
oMap.Legend.Autoextent = True
bInitSuccess = oMap.InitMap(oConnect, MAPSERVICE)
If (Not bInitSuccess) Then
Response.Write ""
Response.End
End If
oMap.Width = CLng(MAPWIDTH)
oMap.Height = CLng(MAPHEIGHT)
Set oLayers = oMap.Layers

'iNumLayers = oLayers.Count

If sMapAction = "" Then
' Just starting up -- get info
xMin = oMap.Extent.xMin
xMax = oMap.Extent.xMax
yMin = oMap.Extent.yMin
yMax = oMap.Extent.yMax

sMapAction = "zoomin" ' default action on startup
Session("LoggedIn") = "False"
Else

xMin = Request.Form("mapXMin")
yMin = Request.Form("mapYMin")
xMax = Request.Form("mapXMax")
yMax = Request.Form("mapYMax")
mapClickX = Request.Form("mapClickX")
mapClickY = Request.Form("mapClickY")
sIDAttributes = Request.Form("idAttributes") ' preserve attribute list
sDBID = Request.Form("dbID")
sZoomToID = Request.Form("zoomToID")
bLoggedIn = Session("LoggedIn")
sUser = Request.Form("uinfo")

' Set the map envelope to the current extent
Set oExtent = Server.CreateObject("aims.Envelope")
oExtent.xMin = xMin
oExtent.xMax = xMax
oExtent.yMin = yMin
oExtent.yMax = yMax

oMap.DoZoomToExtent oExtent

If sDBID <> "" Then
sActionTemp = sMapAction
If sZoomToID = "True" Then sMapAction = "zoomToID" Else sMapAction =
"ShowByID"
End If

Select Case sMapAction

Case "fullextent"
oMap.DoZoomToFullExtent

Case "zoomin"
oMap.CenterAt mapClickX, mapClickY
oMap.DoZoom 5

Case "zoomout"
oMap.CenterAt mapClickX, mapClickY
oMap.DoZoom -5

Case "pan"
oMap.CenterAt mapClickX, mapClickY

Case "identify"
sIDAttributes = DBIdentify(oDBConn, mapClickX, mapClickY, oMap,
oExtent)

Case "ShowByID"
sIDAttributes = DBIdentifyID(oDBConn, sDBID, oMap, False)
sMapAction = sActionTemp ' Restore map action to current tool

Case "zoomToID" ' Zoom to DB Feature by its ID
sIDAttributes = DBIdentifyID(oDBConn, sDBID, oMap, True)
sMapAction = sActionTemp

Case "login"
sUser = Request.Form("uInfo")
bLoggedIn = CheckUserInfo(oDBConn, sUser)
bCreateNewMap = False ' Don't need new map
sExtFeatures = Request.Form("extFeatures") ' (but preserve extent
feature list)

End Select

End If

Set oExtent = oMap.Extent

If bCreateNewMap Then
sExtFeatures = AddDBPoints(oDBConn, oMap, oExtent)

oMap.MapDraw = True
oMap.Legend.Display = True
oMap.Refresh
sMapURL = oMap.GetImageAsURL
sLegURL = oMap.Legend.URL
End If
%>























<%
' Functions for data page

Function AddDBPoints(mConn, mMap, mExtent)
Dim oALyr
Dim sSQL, sFList, sExtSQL
Dim sConnString
Dim oRecSet
Dim sAttr

Set oALyr = CreateObject("aims.AcetateLayer") ' Acetate layer

' Get DB points within current extent from database
sFList = DBXFIELD & "," & DBYFIELD & "," & DBLABELFIELD & "," &
DBIDFIELD
sExtSQL = DBXFIELD & " > " & mExtent.XMin & " AND " & DBXFIELD & " <
" & mExtent.XMax & " AND "
sExtSQL = sExtSQL & DBYFIELD & " > " & mExtent.YMin & " AND " &
DBYFIELD & " < " & mExtent.YMax
sSQL = "SELECT " & sFList & " FROM " & DBTABLE & " WHERE " & sExtSQL

'sAttr = DBIDFIELD & "," & DBLABELFIELD & "::" ' Field list for
attributes

If mConn = "" Then
' Connection not yet created
Set mConn = Server.CreateObject("ADODB.Connection")

End If


mConn.Open Driver="Microsoft ODBC for
Oracle;Server=mdrv;uid=scott;pwd=tiger;"
Response.Write objConn.State
Response.End



'mConn.Open

Set oRecSet = Server.CreateObject("ADODB.Recordset")
'response.write "SQL: " & sSQL & "
"
oRecSet.Open sSQL, mConn

Do While Not oRecSet.EOF
Dim oPt
Set oPt = Server.CreateObject("aims.PointObject")
oPt.x = oRecSet(DBXFIELD)
oPt.y = oRecSet(DBYFIELD)
oPt.Symbol.Color = 16711935 '3329330
oPt.Symbol.Width = 9
oPt.Symbol.MarkerType = 4 'Star
oALyr.Add oPt, 1

' Feature information for display
sAttr = sAttr & oRecSet(DBIDFIELD) & "," & oRecSet(DBLABELFIELD) &
"::"

oRecSet.MoveNext
Loop
If Len(sAttr)>0 Then sAttr = Left(sAttr, Len(sAttr)-2) ' Trim last
::

oRecSet.Close
Set oRecSet = Nothing
mConn.Close
Set mConn = Nothing

'mMap.Layers.Insert oALyr, oLayers.Count-1
mMap.Layers.Add oALyr

AddDBPoints = sAttr
End Function

Function DBIdentify(mConn, pX, pY, mMap, oExt)
' Finds DB features based on map pixel coordinate
'Dim fXMin, fXMax, fYMin, fYMax
Dim oPt1, oPt2
Dim sWhere

' Convert pixel coords to map coords -- add selection margin around
point
Set oPt1 = mMap.ToMapPoint(pX-SELMARGIN, pY+SELMARGIN) ' above/left
Set oPt2 = mMap.ToMapPoint(pX+SELMARGIN, pY-SELMARGIN) ' below/right

sWhere = DBXFIELD & " > " & oPt1.x & " AND " & DBXFIELD & " < " &
oPt2.x & " AND " & _
DBYFIELD & " > " & oPt1.y & " AND " & DBYFIELD & " < " & oPt2.y

DBIdentify = DBQuery(mConn, sWhere, mMap, False)
End Function

Function DBIdentifyID(mConn, sID, mMap, bZoomTo)
' Finds DB features based on ID
Dim sWhere
sWhere = DBIDFIELD & " = " & sID
DBIdentifyID = DBQuery(mConn, sWhere, mMap, bZoomTo)
End Function

Function DBQuery(mConn, sWhere, mMap, bZoomTo)
Dim sFList, sSQL, sAttr
Dim sConnString, oRecSet, oField
Dim oALyr2

Set oALyr2 = CreateObject("aims.AcetateLayer") ' Set up acetate
layer

' Create SQL for identify operation
sFList = DBXFIELD & "," & DBYFIELD & "," & DBLABELFIELD & "," &
DBIDFIELD
If DBDISPLAYFIELDS <> "" Then sFList = sFList & "," & DBDISPLAYFIELDS
sSQL = "SELECT " & sFList & " FROM " & DBTABLE & " WHERE " & sWhere
'Response.Write sSQL & "
" & vbcrlf

' List field name aliases at start of attributes list
sAttr = "Lat,Long1,Name," & DBIDFIELDALIAS & "," & DBDISPLAYALIASES &
"::"

' Connect to database and run query
Set mConn = Server.CreateObject("ADODB.Connection")
'sConnString = DBDSN
'mConn.Open sConnString

'mConn.Open "dsn=DBPoints;uid=scott;pwd=tiger;"

mConn.Open Driver="Microsoft ODBC for
Oracle;Server=mdrv;uid=scott;pwd=tiger;"
Response.Write objConn.State
Response.End

Set oRecSet = Server.CreateObject("ADODB.Recordset")
'response.write "SQL: " & sSQL & "
"
oRecSet.Open sSQL, mConn

' If any records found, highlight on map and get attributes
Do While Not oRecSet.EOF
Dim oPt
Set oPt = Server.CreateObject("aims.PointObject")
oPt.x = oRecSet(DBXFIELD)
oPt.y = oRecSet(DBYFIELD)
'Response.write "Client at: " & oPt.x & "," & oPt.y & "
" &
vbcrlf
oPt.Symbol.Color = 3329330 ' Lime green
oPt.Symbol.Width = 16 ' large symbol
oPt.Symbol.MarkerType = 4 ' Star
oPt.Symbol.Transparency = 0.8
oPt.Symbol.Overlap = False ' Don't put labels on top of symbol
oALyr2.Add oPt, 1 ' Add point to acetate layer

' Get field values for each record
For Each oField in oRecSet.Fields
sAttr = sAttr & oField.Value & ","
Next
sAttr = Left(sAttr, Len(sAttr)-1) & "::" ' Trim last comma

If bZoomTo Then
Dim oExt
Set oExt = Server.CreateObject("aims.Envelope")
oExt.XMin = oRecSet(DBXFIELD) - ZOOMMARGIN
oExt.XMax = oRecSet(DBXFIELD) + ZOOMMARGIN
oExt.YMin = oRecSet(DBYFIELD) - ZOOMMARGIN
oExt.YMax = oRecSet(DBYFIELD) + ZOOMMARGIN
mMap.DoZoomToExtent oExt
End If

oRecSet.MoveNext
Loop
sAttr = Left(sAttr, Len(sAttr)-2) ' Trim last ::

oRecSet.Close
Set oRecSet = Nothing

mConn.Close

mMap.Layers.Add oALyr2 ' Add acetate layer to map

DBQuery = sAttr
End Function

Function CheckUserInfo(mConn, sUser)
Dim sPwd
Dim sSQL
Dim sConnString, oRecSet

'sUser = Request.Form("uinfo") ' Get username/password submitted
sPwd = Request.Form("pinfo")

sSQL = "SELECT " & DBUSERFIELD & " FROM " & DBUSERTABLE & " WHERE " &
DBUSERFIELD
sSQL = sSQL & " = '" & sUser & "' AND " & DBPWDFIELD & " = '" & sPwd
& "'"
'response.write sSQL

' Connect to database and run query
Set mConn = Server.CreateObject("ADODB.Connection")
'sConnString = DBDSN ' System DSN in Control Panel-ODBC
'mConn.Open sConnString

'mConn.Open "dsn=DBPoints;uid=scott;pwd=tiger;"

mConn.Open Driver="Microsoft ODBC for
Oracle;Server=mdrv;uid=scott;pwd=tiger;"
Response.Write objConn.State
Response.End



Set oRecSet = Server.CreateObject("ADODB.Recordset")
oRecSet.Open sSQL, mConn

' If any user record found, then set login to true
Session("LoggedIn") = Not oRecSet.EOF

CheckUserInfo = Not oRecSet.EOF
End Function
%>

Re: Oracle and ASP connection

am 16.02.2005 14:41:03 von JohnBeschler

OK. You're going to have to do a little digging here. If you truly got no
response from that code, then the code is not being executed. You will need
to climb backwards in the code until you find out why that piece of code is
not running.

I would start by adding a response.write line as the first line in the
function.
For example:

Function AddDBPoints(mConn, mMap, mExtent)
RESPONSE.WRITE "Function AddDbPoints" & "
"
RESPONSE.END

You should get a line that says "Function AddDbPoints" and then the
processing should stop. If you get this, then move down the code within the
function, testing until it breaks. If not, then the function is not beling
called and you need to move backwards from there.

HTH,

JOHN







"suyog_linux" wrote:

> <%@ Language=VBScript %>
> <% Option Explicit %>
>
>
>
>
>
>
> Data form for post frame
>
>
>
>
>
>
>
> <%
>
> Dim oConnect
> Dim oMap
> Dim bInitSuccess
> Dim oLayers
> Dim xMin, yMin
> Dim xMax, yMax
> Dim mapClickX, mapClickY
> Dim IDx, IDy, sIDx, sIDy
> Dim sMapAction
> Dim oExtent
> Dim sMapURL, sLegURL
> Dim oDBConn, oRecSet, bConnOpen
> Dim sExtFeatures
> Dim sIDAttributes
> Dim sDBID, sActionTemp, sZoomToID
> Dim sUser, bLoggedIn
> Dim bCreateNewMap
>
> bConnOpen = False ' DB connection not open yet
> bCreateNewMap = True ' Make new map unless turn off
> sMapAction = Request.Form("mapAction")
>
> ' Server & Map connection
> Set oConnect = CreateObject("aims.ArcIMSConnector")
> oConnect.ServerName = MAPSERVER
> oConnect.ServerPort = CLng(MAPPORT)
> Set oMap = CreateObject("aims.Map")
> oMap.MapDraw = False
> oMap.Legend.Display = False
> oMap.Legend.Height = MAPHEIGHT
> oMap.Legend.Title = " "
> oMap.Legend.Width = 130
> oMap.Legend.Autoextent = True
> bInitSuccess = oMap.InitMap(oConnect, MAPSERVICE)
> If (Not bInitSuccess) Then
> Response.Write ""
> Response.End
> End If
> oMap.Width = CLng(MAPWIDTH)
> oMap.Height = CLng(MAPHEIGHT)
> Set oLayers = oMap.Layers
>
> 'iNumLayers = oLayers.Count
>
> If sMapAction = "" Then
> ' Just starting up -- get info
> xMin = oMap.Extent.xMin
> xMax = oMap.Extent.xMax
> yMin = oMap.Extent.yMin
> yMax = oMap.Extent.yMax
>
> sMapAction = "zoomin" ' default action on startup
> Session("LoggedIn") = "False"
> Else
>
> xMin = Request.Form("mapXMin")
> yMin = Request.Form("mapYMin")
> xMax = Request.Form("mapXMax")
> yMax = Request.Form("mapYMax")
> mapClickX = Request.Form("mapClickX")
> mapClickY = Request.Form("mapClickY")
> sIDAttributes = Request.Form("idAttributes") ' preserve attribute list
> sDBID = Request.Form("dbID")
> sZoomToID = Request.Form("zoomToID")
> bLoggedIn = Session("LoggedIn")
> sUser = Request.Form("uinfo")
>
> ' Set the map envelope to the current extent
> Set oExtent = Server.CreateObject("aims.Envelope")
> oExtent.xMin = xMin
> oExtent.xMax = xMax
> oExtent.yMin = yMin
> oExtent.yMax = yMax
>
> oMap.DoZoomToExtent oExtent
>
> If sDBID <> "" Then
> sActionTemp = sMapAction
> If sZoomToID = "True" Then sMapAction = "zoomToID" Else sMapAction =
> "ShowByID"
> End If
>
> Select Case sMapAction
>
> Case "fullextent"
> oMap.DoZoomToFullExtent
>
> Case "zoomin"
> oMap.CenterAt mapClickX, mapClickY
> oMap.DoZoom 5
>
> Case "zoomout"
> oMap.CenterAt mapClickX, mapClickY
> oMap.DoZoom -5
>
> Case "pan"
> oMap.CenterAt mapClickX, mapClickY
>
> Case "identify"
> sIDAttributes = DBIdentify(oDBConn, mapClickX, mapClickY, oMap,
> oExtent)
>
> Case "ShowByID"
> sIDAttributes = DBIdentifyID(oDBConn, sDBID, oMap, False)
> sMapAction = sActionTemp ' Restore map action to current tool
>
> Case "zoomToID" ' Zoom to DB Feature by its ID
> sIDAttributes = DBIdentifyID(oDBConn, sDBID, oMap, True)
> sMapAction = sActionTemp
>
> Case "login"
> sUser = Request.Form("uInfo")
> bLoggedIn = CheckUserInfo(oDBConn, sUser)
> bCreateNewMap = False ' Don't need new map
> sExtFeatures = Request.Form("extFeatures") ' (but preserve extent
> feature list)
>
> End Select
>
> End If
>
> Set oExtent = oMap.Extent
>
> If bCreateNewMap Then
> sExtFeatures = AddDBPoints(oDBConn, oMap, oExtent)
>
> oMap.MapDraw = True
> oMap.Legend.Display = True
> oMap.Refresh
> sMapURL = oMap.GetImageAsURL
> sLegURL = oMap.Legend.URL
> End If
> %>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
> <%
> ' Functions for data page
>
> Function AddDBPoints(mConn, mMap, mExtent)
> Dim oALyr
> Dim sSQL, sFList, sExtSQL
> Dim sConnString
> Dim oRecSet
> Dim sAttr
>
> Set oALyr = CreateObject("aims.AcetateLayer") ' Acetate layer
>
> ' Get DB points within current extent from database
> sFList = DBXFIELD & "," & DBYFIELD & "," & DBLABELFIELD & "," &
> DBIDFIELD
> sExtSQL = DBXFIELD & " > " & mExtent.XMin & " AND " & DBXFIELD & " <
> " & mExtent.XMax & " AND "
> sExtSQL = sExtSQL & DBYFIELD & " > " & mExtent.YMin & " AND " &
> DBYFIELD & " < " & mExtent.YMax
> sSQL = "SELECT " & sFList & " FROM " & DBTABLE & " WHERE " & sExtSQL
>
> 'sAttr = DBIDFIELD & "," & DBLABELFIELD & "::" ' Field list for
> attributes
>
> If mConn = "" Then
> ' Connection not yet created
> Set mConn = Server.CreateObject("ADODB.Connection")
>
> End If
>
>
> mConn.Open Driver="Microsoft ODBC for
> Oracle;Server=mdrv;uid=scott;pwd=tiger;"
> Response.Write objConn.State
> Response.End
>
>
>
> 'mConn.Open
>
> Set oRecSet = Server.CreateObject("ADODB.Recordset")
> 'response.write "SQL: " & sSQL & "
"
> oRecSet.Open sSQL, mConn
>
> Do While Not oRecSet.EOF
> Dim oPt
> Set oPt = Server.CreateObject("aims.PointObject")
> oPt.x = oRecSet(DBXFIELD)
> oPt.y = oRecSet(DBYFIELD)
> oPt.Symbol.Color = 16711935 '3329330
> oPt.Symbol.Width = 9
> oPt.Symbol.MarkerType = 4 'Star
> oALyr.Add oPt, 1
>
> ' Feature information for display
> sAttr = sAttr & oRecSet(DBIDFIELD) & "," & oRecSet(DBLABELFIELD) &
> "::"
>
> oRecSet.MoveNext
> Loop
> If Len(sAttr)>0 Then sAttr = Left(sAttr, Len(sAttr)-2) ' Trim last
> ::
>
> oRecSet.Close
> Set oRecSet = Nothing
> mConn.Close
> Set mConn = Nothing
>
> 'mMap.Layers.Insert oALyr, oLayers.Count-1
> mMap.Layers.Add oALyr
>
> AddDBPoints = sAttr
> End Function
>
> Function DBIdentify(mConn, pX, pY, mMap, oExt)
> ' Finds DB features based on map pixel coordinate
> 'Dim fXMin, fXMax, fYMin, fYMax
> Dim oPt1, oPt2
> Dim sWhere
>
> ' Convert pixel coords to map coords -- add selection margin around
> point
> Set oPt1 = mMap.ToMapPoint(pX-SELMARGIN, pY+SELMARGIN) ' above/left
> Set oPt2 = mMap.ToMapPoint(pX+SELMARGIN, pY-SELMARGIN) ' below/right
>
> sWhere = DBXFIELD & " > " & oPt1.x & " AND " & DBXFIELD & " < " &
> oPt2.x & " AND " & _
> DBYFIELD & " > " & oPt1.y & " AND " & DBYFIELD & " < " & oPt2.y
>
> DBIdentify = DBQuery(mConn, sWhere, mMap, False)
> End Function
>
> Function DBIdentifyID(mConn, sID, mMap, bZoomTo)
> ' Finds DB features based on ID
> Dim sWhere
> sWhere = DBIDFIELD & " = " & sID
> DBIdentifyID = DBQuery(mConn, sWhere, mMap, bZoomTo)
> End Function
>
> Function DBQuery(mConn, sWhere, mMap, bZoomTo)
> Dim sFList, sSQL, sAttr
> Dim sConnString, oRecSet, oField
> Dim oALyr2
>
> Set oALyr2 = CreateObject("aims.AcetateLayer") ' Set up acetate
> layer
>
> ' Create SQL for identify operation
> sFList = DBXFIELD & "," & DBYFIELD & "," & DBLABELFIELD & "," &
> DBIDFIELD
> If DBDISPLAYFIELDS <> "" Then sFList = sFList & "," & DBDISPLAYFIELDS
> sSQL = "SELECT " & sFList & " FROM " & DBTABLE & " WHERE " & sWhere
> 'Response.Write sSQL & "
" & vbcrlf
>
> ' List field name aliases at start of attributes list
> sAttr = "Lat,Long1,Name," & DBIDFIELDALIAS & "," & DBDISPLAYALIASES &
> "::"
>
> ' Connect to database and run query
> Set mConn = Server.CreateObject("ADODB.Connection")
> 'sConnString = DBDSN
> 'mConn.Open sConnString
>
> 'mConn.Open "dsn=DBPoints;uid=scott;pwd=tiger;"
>
> mConn.Open Driver="Microsoft ODBC for
> Oracle;Server=mdrv;uid=scott;pwd=tiger;"
> Response.Write objConn.State
> Response.End
>
> Set oRecSet = Server.CreateObject("ADODB.Recordset")
> 'response.write "SQL: " & sSQL & "
"
> oRecSet.Open sSQL, mConn
>
> ' If any records found, highlight on map and get attributes
> Do While Not oRecSet.EOF
> Dim oPt
> Set oPt = Server.CreateObject("aims.PointObject")
> oPt.x = oRecSet(DBXFIELD)
> oPt.y = oRecSet(DBYFIELD)
> 'Response.write "Client at: " & oPt.x & "," & oPt.y & "
" &
> vbcrlf
> oPt.Symbol.Color = 3329330 ' Lime green
> oPt.Symbol.Width = 16 ' large symbol
> oPt.Symbol.MarkerType = 4 ' Star
> oPt.Symbol.Transparency = 0.8
> oPt.Symbol.Overlap = False ' Don't put labels on top of symbol
> oALyr2.Add oPt, 1 ' Add point to acetate layer
>
> ' Get field values for each record
> For Each oField in oRecSet.Fields
> sAttr = sAttr & oField.Value & ","
> Next
> sAttr = Left(sAttr, Len(sAttr)-1) & "::" ' Trim last comma
>
> If bZoomTo Then
> Dim oExt
> Set oExt = Server.CreateObject("aims.Envelope")
> oExt.XMin = oRecSet(DBXFIELD) - ZOOMMARGIN
> oExt.XMax = oRecSet(DBXFIELD) + ZOOMMARGIN
> oExt.YMin = oRecSet(DBYFIELD) - ZOOMMARGIN
> oExt.YMax = oRecSet(DBYFIELD) + ZOOMMARGIN
> mMap.DoZoomToExtent oExt
> End If
>
> oRecSet.MoveNext
> Loop
> sAttr = Left(sAttr, Len(sAttr)-2) ' Trim last ::
>
> oRecSet.Close
> Set oRecSet = Nothing
>
> mConn.Close
>
> mMap.Layers.Add oALyr2 ' Add acetate layer to map
>
> DBQuery = sAttr
> End Function
>
> Function CheckUserInfo(mConn, sUser)
> Dim sPwd
> Dim sSQL
> Dim sConnString, oRecSet
>
> 'sUser = Request.Form("uinfo") ' Get username/password submitted
> sPwd = Request.Form("pinfo")
>
> sSQL = "SELECT " & DBUSERFIELD & " FROM " & DBUSERTABLE & " WHERE " &
> DBUSERFIELD
> sSQL = sSQL & " = '" & sUser & "' AND " & DBPWDFIELD & " = '" & sPwd
> & "'"
> 'response.write sSQL
>
> ' Connect to database and run query
> Set mConn = Server.CreateObject("ADODB.Connection")
> 'sConnString = DBDSN ' System DSN in Control Panel-ODBC
> 'mConn.Open sConnString
>
> 'mConn.Open "dsn=DBPoints;uid=scott;pwd=tiger;"
>
> mConn.Open Driver="Microsoft ODBC for
> Oracle;Server=mdrv;uid=scott;pwd=tiger;"
> Response.Write objConn.State
> Response.End
>
>
>
> Set oRecSet = Server.CreateObject("ADODB.Recordset")
> oRecSet.Open sSQL, mConn
>
> ' If any user record found, then set login to true
> Session("LoggedIn") = Not oRecSet.EOF
>
> CheckUserInfo = Not oRecSet.EOF
> End Function
> %>
>
>

Re: Oracle and ASP connection

am 16.02.2005 14:50:40 von suyog_linux

thank you sir

i will try and let you know

Re: Oracle and ASP connection

am 16.02.2005 15:06:17 von suyog_linux

sir i started to debug this code the next error tht i have got is

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/sss/Data.asp, line 216

Re: Oracle and ASP connection

am 16.02.2005 15:16:24 von suyog_linux

sir i have started to debug the code line by line and following is the
error that i got on mconn.open line

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/sss/Data.asp, line

Re: Oracle and ASP connection

am 16.02.2005 16:05:03 von JohnBeschler

That tells me that either you have an error in your connection string, or
your DSN is not configured correctly.

Can you access the db using any other application via this DSN?


"suyog_linux" wrote:

> sir i started to debug this code the next error tht i have got is
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> [Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified
> /sss/Data.asp, line 216
>
>

Re: Oracle and ASP connection

am 16.02.2005 16:28:35 von Mark Schupp

What version of the Oracle Network Client are you using?

I have seen comments that the error you mention is caused by the IUSR
account not having permissions on the Oracle directory where the client
software is stored.

If you are using Oracle 9 or 10 client software it is also possible that the
Microsoft ODBC for Oracle driver needs updating. Earlier versions did not
support past Oracle 8. I think the latest version does but I have had
variable results. You may want to switch to the Oracle OleDB provider.
Install it and change the connection string to:

Provider=OraOLEDB.Oracle;Data Source=;User Id= name here>;Password=

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"asp_ora" wrote in message
news:5295a58c.0502160232.22426abd@posting.google.com...
> hi all,
> i am trying to connect to oracle thru an ASP page ... for this i
> write a code as below
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "dsn=OracleDSN;uid=userid;pwd=password;"
>
> after this i am trying to display the rows of a table in the database
>
> The problem is when i tried to run the ASP page on my comp which has
> IIS 5.0 on it it gave me an error saying Oracle Client required but i
> have Oracle Client on my system.
> on second time onwards i didnot get this error at all neither i could
> see something on the page (which actually should display rows) i am
> getting wht is problem and wht is solution for this .
>
> Plz help .........

Re: Oracle and ASP connection

am 17.02.2005 06:17:41 von suyog_linux

i am using oracle 9i client .

and i dont knwo how to give priviledge to IUSR for oracle directory plz
explain .


suyog