Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

DNS-less connection to Sybase

Posted on 1998-11-17
7
636 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

856 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