Solved

DNS-less connection to Sybase

Posted on 1998-11-17
7
626 Views
Last Modified: 2013-12-25
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.
0
Comment
Question by:Joe33
7 Comments
 

Author Comment

by:Joe33
ID: 1497684
Edited text of question
0
 
LVL 3

Expert Comment

by:vmano
ID: 1497685
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
 

Author Comment

by:Joe33
ID: 1497686
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 3

Expert Comment

by:vmano
ID: 1497687
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
 

Expert Comment

by:Coates
ID: 1497688
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
 

Author Comment

by:Joe33
ID: 1497689
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
 
LVL 1

Accepted Solution

by:
pmteixeira earned 200 total points
ID: 1497690
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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question