DNS-less connection to Sybase

I'm trying to make a DSN-less RDO connection to a Sybase SQL server. I can make the connection fine with a user DSN, but I want to make the connection without the DSN. Here's what I'm using...

strConnection = "UID=user;PWD=password;" _
    & "DATABASE=dbname;" _
    & "SERVER=SYBASE;" _
    & "DRIVER={Sybase System 11};DSN='';"
Set rdoCon = rdoEnv.OpenConnection(dsName:="", _
    prompt:=rdDriverNoPrompt, _
    Connect:=strConnection)

If I set the prompt to rdDriverPrompt, I get a dialog box that allows me to enter 'SYBASE' as the server, and the connection is made - my query won't run (not sure why - says no cursor is open), but it does connect. However, running the connection above with rdDriverNoPrompt(which is how it should run) results in an error - [Intersolv][ODBC SQL Server Driver] Invalid attribute in connection string: SERVER. - which sounds like a syntax error, but that format is straight from the help file. Anyone have any ideas? Thanks.
Joe33Asked:
Who is Participating?
 
pmteixeiraCommented:
Hi Joe,

if you still have this problem, why don't you set the prompt to rdDriverPrompt and normally enter your code, adding this line to it:

       MsgBox rdoCon.Connect

This way you can see the connect string that was used (and this one must work)! Like you, I believe that your error is a syntax error due to the driver you're using!
But after having a correct ConnectString you may paste it into your code and use rdDriverNoPrompt.

Hope this helps,

PMT
0
 
Joe33Author Commented:
Edited text of question
0
 
vmanoCommented:
is your server/computer name SYBASE? if not, try this:
change the parameter SERVER to the server/computer name where the database is.you can find the computer name in controlpanel->network->identification tab. and also, you don't have to specify the DSN parameter.

let me know if this helps
vmano
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Joe33Author Commented:
The server is named 'SYBASE'...if I run the connect string with an rdDriverPrompt, I can enter the server name (SYBASE) and it will make a connection. For some reason, it won't connect when it's an rdDriverNoPrompt, I get the 'invalid attribute: SERVER' when it runs. Thanks again.
0
 
vmanoCommented:
try this:
Dim cn As New rdoConnection
Dim qd As New rdoQuery

cn.Connect = "uid=USER;pwd=PASSWORD;server=SYBASE;" _
    & "driver={Sybase System 11};database=DBNAME;DSN='';"
cn.cursordriver = rdUseOdbc
cn.EstablishConnection rdDriverNoprompt
debug.print cn.Connect

Set qd.ActiveConnection = cn

let me know if this helps
vmano
0
 
CoatesCommented:
You can specify the Server Name etc while setting up the ODBC under control panel. This means that you only have to reference the DSN name in your code and the predefined ODBC will do the rest:
e.g:
Dim cn as rdoConnection;
cn.Connect = "DSN=dsnname;UID=uid;PWD=password";
cn.CursorDriver = rdUseODBC
cn.EstablishConnection rdDriverNoPrompt

This should connect using the server and driver details specified in control panel and then connect without showing a dialog box, which is what i think you want.
Hope this works,
0
 
Joe33Author Commented:
I've gotten it to work with a DSN, I'm trying to avoid setting up a DSN on every client machine by using a DSN-less connection.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.