1 dbsV
ee
tc
ro
si
nn
oe
nc4
t.0 -(
-O5
S/1
2,
/89
MS-DOS and Macintosh only)
______________________________________________________________________
NAME: dbsetconnect (OS/2, MS-DOS and Macintosh only)
FUNCTION:
Allocate and initialize a network connection structure.
SYNTAX:
RETCODE dbsetconnect(service_type, net_type, net_name,
machine_name, port)
char *service_type;
char *net_type;
char *net_name;
dbsetconnect (OS/2, MS∀D
e®S
sia
ond4.
M0
ac-
iπt5
o/
s1
h/8
o9
nly) 2
______________________________________________________________________
char *machine_name;
char *port;
COMMENTS:
o This routine allocates and initializes a network connection
structure. It provides an alternative method by which an
application can specify the parameters required to open a con-
nection to a SQL Server.
o dbsetconnect() supersedes the interfaces file mechanism,
described on the dbsetifile manual page and in the SYBASE
Installation Guide. If dbsetconnect() has not been called,
dbopen() uses the interfaces file to determine the proper
SQL Server to connect to.
o When you use dbsetconnect() to specify the SQL Server, you
should set the second dbopen() parameter, server, to NULL. If
dbopen() receives a non-NULL server name, it will use the
3 dbsV
ee
tc
ro
si
nn
oe
nc4
t.0 -(
-O5
S/1
2,
/89
MS-DOS and Macintosh only)
______________________________________________________________________
interfaces file mechanism, instead of dbsetconnect().
o Here's a program fragment that uses dbsetconnect() and dbo-
pen():
DBPROCESS *dbproc;
LOGINREC *loginrec;
loginrec = dblogin();
DBSETLPWD(loginrec, "server_password");
DBSETLAPP(loginrec, "my_program");
dbsetconnect("query", "tcp", "sun-ether", "rose", "1025");
dbproc = dbopen(loginrec, NULL);
PARAMETERS:
service_type - The type of service you what. Usually, it is
"query".
dbsetconnect (OS/2, MS∀D
e®S
sia
ond4.
M0
ac-
iπt5
o/
s1
h/8
o9
nly) 4
______________________________________________________________________
net_type - The type of network you want. The name you supply
must be one of the types recognized by DB-Library, such as
"tcp", "decnet", or "nmpipe". If an invalid net_type is sup-
plied, calls to dbopen() will fail.
net_name - The type of network media you use. The name you sup-
ply must be one of the recognized types, such as "sun-ether",
"pyramid-ether", "dec-ether", or "nmpipe-ether".
machine_name - The name of the machine on which SQL Server
resides.
port - The port to which the application will connect. When the
application is connecting to UNIX systems, for example, port
is a socket number.
RETURNS:
SUCCEED or FAIL. dbsetconnect() returns SUCCEED if everything
went well. It returns FAIL if a structure couldn't be created or
5 dbsV
ee
tc
ro
si
nn
oe
nc4
t.0 -(
-O5
S/1
2,
/89
MS-DOS and Macintosh only)
______________________________________________________________________
initialized.
ERRORS:
dbsetconnect() will return FAIL if the following is true:
SYBEMEM Unable to allocate sufficient memory.
SEE ALSO:
dbopen, dbsetifile