freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: yan AT cbmi.upmc.edu
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: iodbc and freetds
- Date: Sun, 29 Aug 1999 18:34:04 -0400 (EDT)
Brian,
Thank you for the advice. I am still having the same problem
accessing my SQL 6.5 database from my Solaris 2.6 box. I tested the code
on my linux box and am having the same problem. I can give you access to
the database and if this would help you trace the problem (to the actual
sun box). I compiled freetds successfully and ran the samples for
tds successfully on my box. Here is the code and the interface
configuration I am using:
#include <stdio.h>
#include <tds.h>
static char software_version[] = "$Id: tdstest.c,v 1.5 1999/06/13
00:07:17 camber Exp $";
static void *no_unused_var_warn[] = {software_version,
no_unused_var_warn};
char *value_as_string(
TDSSOCKET *tds,
int col_idx)
{
static char result[256];
const int type = tds->res_info->columns[col_idx]->column_type;
const char *row = tds->res_info->current_row;
const int offset = tds->res_info->columns[col_idx]->column_offset;
const void *value = (row+offset);
switch(type)
{
case SYBVARCHAR:
{
strncpy(result, (char *)value, sizeof(result)-1);
result[sizeof(result)-1] = '\0';
break;
}
case SYBINT4:
{
sprintf(result, "%d", *(int *)value);
break;
}
default:
{
strcpy(result, "NotImp");
break;
}
}
return result;
} /* value_as_string() */
int main()
{
TDSLOGIN *login;
TDSSOCKET *tds;
int rc;
int i;
login = tds_alloc_login();
tds_set_passwd(login,"byteme4");
tds_set_user(login,"sa");
tds_set_app(login,"sqsh");
tds_set_host(login,"color");
tds_set_library(login,"TDS-Library");
tds_set_server(login,"pharos");
tds_set_charset(login,"iso_1");
tds_set_language(login,"us_english");
tds_set_packet(login,512);
if (!(tds = tds_connect(login))) {
fprintf(stderr, "Login Failed!\n");
exit(1);
}
/* tds_submit_query(tds,"select db_name() dbname, user_name()
username"); */
/* tds_submit_query(tds,"select idx from groups"); */
tds_submit_query(tds,"use pharos select id from users where
id='shaykin'");
while ((rc=tds_process_result_tokens(tds))==TDS_SUCCEED)
{
for (i=0; i<tds->res_info->num_cols; i++)
{
printf("col %d\n Type: %d\n Name: %s\n Offset: %d\n",
i,
tds->res_info->columns[i]->column_type,
tds->res_info->columns[i]->column_name,
tds->res_info->columns[i]->column_offset);
}
while ((rc=tds_process_row_tokens(tds))==TDS_SUCCEED)
{
for (i=0; i<tds->res_info->num_cols; i++)
{
printf("col %i is %s\n", i, value_as_string(tds, i));
}
}
}
return 0;
}
Interfaces
JDBC
query tcp ether 192.138.151.39 4444
master tcp ether 192.138.151.39 4444
myserver
query tcp ether 127.0.0.1 4000
master tcp ether 127.0.0.1 4000
myserver2
query tcp ether 127.0.0.1 4001
master tcp ether 127.0.0.1 4001
color
query tcp ether 136.142.141.13 1433
pharos tcp ether 136.142.141.13 1433
The password and username will work for testing purposes.
The SQL database I am trying to access is pharos and I can access it from
my DBI:odbc perl scripts on a win32 platform (configured with odbc32
client). Any tips would be profusely welcomed.
Yantiff
On Sun, 29 Aug 1999, Brian Bruns wrote:
>
> Hi,
>
> The obdc library is extremely alpha quality (if that) right now. I
> wouldn't recommend using it. There is another group that created an ODBC
> driver on top of libtds and we will be merging that back into the main
> library soon instead of the ODBC driver that is presently there. (The new
> one will use unixODBC instead of iODBC for a driver manager).
>
> I would reccomend using dblib or ctlib for the time being if that is an
> option for you.
>
> Brian
>
> On Sun, 29 Aug 1999 yan AT cbmi.upmc.edu wrote:
>
> > To nay of you that have done this,
> >
> >
> > I compiled the iodbc-2.12.and successfully compiled the
> > libtdsodbc.so etc. libraries. However, I cannot find any sample code that
> > shows me how to use it. Could anyone provide me with simple code that
> > does freetdsodbc or instructions on how to do so?
> >
> > Yantiff
> >
>
>
> ---
> You are currently subscribed to freetds as: yan AT cbmi.upmc.edu
> To unsubscribe, forward this message to $subst('Email.Unsub')
>
-
iodbc and freetds,
yan, 08/29/1999
- <Possible follow-up(s)>
- Re: iodbc and freetds, Brian Bruns, 08/29/1999
- Re: iodbc and freetds, yan, 08/29/1999
- Re: iodbc and freetds, Brian Bruns, 08/29/1999
- Re: iodbc and freetds, yan, 08/29/1999
- Re: iodbc and freetds, Brian Bruns, 08/29/1999
- Re: iodbc and freetds, yan, 08/29/1999
- Re: iodbc and freetds, Brian Bruns, 08/29/1999
- Re: iodbc and freetds, yan, 08/30/1999
Archive powered by MHonArc 2.6.24.