Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN-less connection string for Oracle10g

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
Good day good Sirs/Ma'ams.

It is my first time to try a DSN-less connection to our Oracle server using the connection string from and from the help file. It was said that no TNSNAMES.ORA file is needed as long as the Oracle ODBC driver is installed, the code below should work. But it doesn't. The ODBC connection dialog box pops up and keeps asking for the service name every time even though it is already specified in the code (blue text). If I manually type the service name in the dialog box, ora_conn is a positive number. That means it is still reading the TNSNAMES.ORA. Anyone have ideas?

Code:
ora_conn = SQLSTRINGCONNECT("DRIVER={Oracle in OraClient10g_home1};" + ;
    [COLOR=#3465A4]"SERVER=" + ;
        "(DESCRIPTION = " + ;
            "(ADDRESS = " + ;
                "(PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = XXX))" + ;
                "(CONNECT_DATA = " + ;
                "(SERVICE_NAME = OurDbServiceName)));" + ;[/color]
    "UID=dbuser;" + ;
    "PWD=dbpw;")

TIA

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
I have not attempted to make these two 'talk' to each other, but if I do a Google Search for: VFP ORACLE
I get a number of 'finds' that might be worth looking at.

Good Luck,
JRB-Bldr
 
Thanks JRB. I already have success in connecting to our Oracle server through DSN connection, but not with DSN-less connection. Problem stated above.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
You have the right number of opening and closing brackets, but I'd double check if this kiond of nesting attributes is along driver rules. In general ODBC parameters are not specified in nested brackets at all, this must be very specific to Oracle.

You should perhaps compute the connection string into a variable and display it for visual inspection of its completeness. Also you can test it eg in a cursoradapter, though that would most probably pop up the same error.

Yes, you specify the ´service name, but has it to go into streing delimiters? Is it at the correct place and nesting?

Bye, Olaf.
 
Kilroy,

What I sometimes do in cases like this is to use the Data Sources applet in Control Panel (might be called ODBC, depending on your OS version):

- Launch the applet, and select File DSN.

- Click Add.

- Go through the wizard, making your settings.

The end-product is a file with extension DSN. By default, this is stored in your ODBC folder (C:\Program Files\Common Files\ODBC\Data Sources in my system; yours might be different). The file is an ordinary text file which contains each item of the connection string on a separate line. You only need to string them together in a single line, and you have the value for the connection string.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Sir Mike,

Thanks but I understand your suggestion will still end up using the TNSNAMES.ORA file. I want to avoid distributing the said file to the boxes that will run this app so I followed the suggestion from this link. The question was originally for ASP but the connection string is pretty much the same. Notice the part "dsnless without tnsnames".

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Sir Olaf,

OlafDoschke said:
...but has it to go into streing delimiters?
No need. It will generate an error if I do that.

OlafDoschke said:
Is it at the correct place and nesting?
Yes. As long as the "DRIVER" parameter is the first parameter. Actually, the "SERVER" parameter comes from the TNSNAMES.ORA file. Whatever was defined there I just substituted them in the connection string.


kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Well, then perhaps your driver version does not work with the .ORA file content put into the connection string.
If the DSN is the only thing that works, that's it. I don't see anything more you can do.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top