Link to home
Start Free TrialLog in
Avatar of bylj
bylj

asked on

Connection

I'm new at both Oracle and ASP. In tnsnames.ora have:
SER1 =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = machine1)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = ser)
   )

For "ser": For SQL+ use:
login: bylj
pass: byljpass
HostString: ser

Now want to connect my site I first need to set up an ODBC-connection:

ODBC-DataSource-Administrator/System-DSN/Add/Oracle8-ODBC-Driver-Setup-Window:

What do I put under "DataSource":
ServiceName: ?? (WHAT DO I PUT HERE?)
UserID: ??   (WHAT DO I PUT HERE?)

Once an ODBC is constructed, need to make a connection-string. How do I make one using the following example for MS-Access:

strConnect = "Provider=MSDataShape;Data Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source="C:\db.MDB;"
Set conn = Server.CreateObject("ADODB.Connection")conn.Open strConnect


Need help
ASKER CERTIFIED SOLUTION
Avatar of jitganguly
jitganguly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bylj
bylj

ASKER

jitganguly: Firstly, thanks. I'm using DataShaping and therefore would like to get the connection in the following format:

strConnect = "Provider=MSDataShape;Data Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source="C:\db.MDB;"
Set conn = Server.CreateObject("ADODB.Connection")conn.Open strConnect

need help.
Why use a DSN?  You can pass a DSN-Less connection string directly to the provider, and not have to fool around with ODBC and DSN.  It is much easier.

Example:

'Define database object
dim dbObj
set dbObj=server.createobject("ADODB.Connection")


'Set database connection string (DSN-LESS of Course)  :)

''''''''''''''''''''''''''''''''''''''''''''''''''
'This one is for current Oracle Driver
''''''''''''''''''''''''''''''''''''''''''''''''''

dim dbStr
dbStr= "Driver={Microsoft ODBC for Oracle};" & _
       "Server=OracleServer.world;" & _
       "Uid=UserID;" & _
       "Pwd=Password;"
''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''
'Or use this one for older Oracle Connections.
''''''''''''''''''''''''''''''''''''''''''''''''''

dim dbStr
dbStr= "Driver={Microsoft ODBC for Oracle};" & _
       "ConnectionString=OracleServer.world;" & _
       "Uid=UserID;" & _
       "Pwd=Password;"
''''''''''''''''''''''''''''''''''''''''''''''''''

dbObj.Open dbStr 'Open database connection.

Hope this helps out.

~ch




You can try with something like

"Provider=MSDAORA;Data Source=serverName;User ID=userName; Password=userPassword;"

http://msdn.microsoft.com/library/psdk/dasdk/pg_a4c9v.htm
Avatar of bylj

ASKER

jitganguly: With
"Provider=MSDAORA;Data Source=serverName;User ID=userName; Password=userPassword;"

Do I need to setup an ODBC connectivity? Also how can I find the serverName?(My machine-name:"machine1", webserver:"localhost")
No you don't need to create a odbc dsn.Server name shoudl be same as tnsname in tnsnames.ora. Also try to give .world name i.e. ser1.world
Avatar of bylj

ASKER

jitganguly:

<%
strConnect = "Provider=MSDAORA;Data Source=ser1.world;User ID=wtuser; Password=wtuser;"
Set conn = Server.CreateObject("ADODB.Connection")conn.Open strConnect
strSQL = "SELECT * FROM Customer;"

Set rs = conn.Execute(strSQL)

Response.write rs(0)
Response.write rs(1)

conn.close
SET rs=NOTHING
SET conn=NOTHING
%>

I'm getting the following error:
"Error Type:
Microsoft OLE DB Provider for Oracle (0x80004005)
Oracle error occurred, but error message could not be retrieved from Oracle.
/testOracle.asp, line 7"

Please help
byli,
I can not access my mail.So could not see your reply.
Now let me see your problem.
1. Are you able to got SQLPLus ?
2. Can you ping your oracle server by tnsping80 located in oracle/bin directory ?
3. You do not need a semicolon after the sql statement

strSQL = "SELECT * FROM Customer;" ' Wrong
strSQL = "SELECT * FROM Customer" ' right



Avatar of bylj

ASKER

1. Are you able to got SQLPLus ?
Yes, I can into SQL+

2. Can you ping your oracle server by tnsping80 located in oracle/bin directory ?
How do I it? (I'm new so please bear with me)

3. You do not need a semicolon after the sql statement
Thanks

Still stuck...
If SQLPlus iw working ok, you don't need to ping it. The way to do is go to oracle\bin in dos prompt and type tnsping80 yourservername

1.Which Mdac you have ? Try to use 2.5
2. Did you install oracle client on the web server ? SQL*Net etc. ?
3. Why don't you try connecting with a DSN first
4. I am not sure about this connection

"strConnect = "Provider=MSDAORA;Data Source=ser1.world;User ID=wtuser; Password=wtuser;"
Set conn = Server.CreateObject("ADODB.Connection")conn.Open strConnect"

Try
strConnect = "Provider=MSDAORA;Data Source=ser1.world;User ID=wtuser; Password=wtuser;"
Set conn = Server.CreateObject("ADODB.Connection")

conn.Open strConnect ' This line needs to be in the next of the previous line

5. Check this link
http://support.microsoft.com/support/kb/articles/Q193/2/25.ASP


bylj---->  You have asked 57 questions at this site and only closed 39 of them, which is against our site's Guidelines.  Please click the HELP DESK link on the left regarding Member Agreement, Guidelines and the Question/Answer process.  I will be updating all your open questions with this information and monitor them for closures.  Please return as quickly as possible to complete these questions.  If special handling is needed, comment here with details.

Open today:
https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20091636
https://www.experts-exchange.com/jsp/qShow.jsp?ta=win2k&qid=20241395
https://www.experts-exchange.com/jsp/qShow.jsp?ta=win2k&qid=20241043
https://www.experts-exchange.com/jsp/qShow.jsp?ta=dbgen&qid=20247085
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msaccess&qid=20237668
https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20088755
https://www.experts-exchange.com/jsp/qShow.jsp?ta=hardgen&qid=20228196
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20248490
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20108859
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20091635
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20088839
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20087841
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20085748
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20081510
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20081065
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msvisdev&qid=20088291
https://www.experts-exchange.com/jsp/qShow.jsp?ta=networkgen&qid=20220006
https://www.experts-exchange.com/jsp/qShow.jsp?ta=networkgen&qid=20198006

It helps you tremendously to remain active in all your open questions, provide ongoing feedback to the experts who step in to help you so that your goal can be achieved quickly, and the expert(s) awarded with points for their excellent help.

Your responsiveness to these is appreciated.

Moondancer
Community Support Moderator @ Experts Exchange
I think I deserve some points here.
Admin notified of User neglect. Force-accepted by
Netminder
Community Support Moderator
Experts Exchange