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
%>