|
-
Mar 3rd, 2003, 09:55 AM
#1
Thread Starter
Frenzied Member
ODBC to Oracle...problem!!!!
I have read about this problem before on forums, but I think mine is a bit special.
I am strying to get data from an oracle db, by using a WORKING ODBC connection. I have used this ODBC connection with crystal reports, so I know it is working. Now, I downloaded microsofts .net odbc (Microsoft.Data.Odbc; ) and from within my .NET application I have problems.
1)The Oracle DB contains several instances (like databases in SQL). How can I in the connection string, specify which one I want to work with??????
2)How should a CORRECT connection string look like? I want to connect by using the DSN.
3)I get the error that Oracle client software isn't installed when I run the application. That's correct I am not using oracle software on my workstation. I don't want to use it either...
Here is the code Im using... faulty
PHP Code:
using Microsoft.Data.Odbc;
namespace oracle_odbc_lab
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Build a connection and SQL strings
string connectionString
= @"Driver={Microsoft ODBC for Oracle};Server=testing.BMCEDS;UID=eda_user;PWD=eda" ;
string SQL = "SELECT NAME FROM DATASOURCE";
// Create connection object
OdbcConnection conn = new OdbcConnection(connectionString);
// Create command object
OdbcCommand cmd = new OdbcCommand(SQL);
cmd.Connection = conn;
// Open connection
conn.Open();
// Call command's ExecuteReader
OdbcDataReader reader = cmd.ExecuteReader();
// Read the reader and display results on the console
while (reader.Read())
{
Response.Write("Name:" + reader.GetString(0).ToString());
Response.Write(" ,");
//Console.WriteLine("Customer:" + reader.GetString(1).ToString() );
}
// close reader and connection
reader.Close();
conn.Close();
}
And we have made the mapping to the instance at the central oracle client (not my workstation). But that shouldn't matter since I am trying to use a WORKING LOCAL ODBC.
anyone who can help?
kind regards
Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|