|
|
Choosing A Webhost: |
Need Help on dblib program: msg#00066db.tds.freetds
I'm having problems with a dblib program and hope you can help, I've tried to simplify it as much as i can. I'm using sybase 12.0 and freetds 0.61. It works fine with the sybase libraries so I think freetds is walking on some variable, or I'm declaring something incorrectly. Here's the table definition: create table table1 (id int null, aid int null, did int null, bmonth int null, bday int null, byear int null, dmonth int null, dday int null, dyear int null, dage float null, gender varchar(1) null, orderinlist int null, i1 varchar(4) null, i2 varchar(4) null, i3 varchar(4) null, i4 varchar(4) null, i5 varchar(4) null, family varchar(1) null) Here's my program: #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sybfront.h> #include <sybdb.h> #include <syberror.h> int err_handler(); int msg_handler(); FILE *ERR_CH; main(int argc, char** argv) { DBPROCESS *dbproc; LOGINREC *login; DBCHAR i1[5], i2[5], i3[5], i4[5], i5[5], family; DBINT id, did, dmonth, dday, dyear, order; float dage; if ((ERR_CH = fopen("Test.Err", "w")) == NULL) { perror("Test.Err"); exit(1); } dberrhandle(err_handler); dbmsghandle(msg_handler); putenv("SYBASE=/usr/local/freetds"); if (dbinit() == FAIL) { fprintf(stderr, "Database failure\n"); exit(1); } login = dblogin(); DBSETLUSER(login, "backus"); DBSETLPWD(login, "maddog12"); dbproc = dbopen(login, NULL); dbcmd(dbproc, "select id, did, dmonth, dday, dyear, "); dbcmd(dbproc, "dage, orderinlist, i1, i2, i3, i4, i5, "); dbcmd(dbproc, "family from table1 order by id "); dbsqlexec(dbproc); dbsqlexec(dbproc); if(dbresults(dbproc) == SUCCEED) { dbbind(dbproc, 1, INTBIND, (DBINT)0, (BYTE*) &id); dbbind(dbproc, 2, INTBIND, (DBINT)0, (BYTE*) &did); dbbind(dbproc, 3, INTBIND, (DBINT)0, (BYTE*) &dmonth); dbbind(dbproc, 4, INTBIND, (DBINT)0, (BYTE*) &dday); dbbind(dbproc, 5, INTBIND, (DBINT)0, (BYTE*) &dyear); dbbind(dbproc, 6, REALBIND, (DBINT)0, (BYTE*) &dage); dbbind(dbproc, 7, INTBIND, (DBINT)0, (BYTE*) &order); dbbind(dbproc, 8, STRINGBIND, (DBINT)0, (BYTE*) i1); dbbind(dbproc, 9, STRINGBIND, (DBINT)0, (BYTE*) i2); dbbind(dbproc, 10, STRINGBIND, (DBINT)0, (BYTE*) i3); dbbind(dbproc, 11, STRINGBIND, (DBINT)0, (BYTE*) i4); dbbind(dbproc, 12, STRINGBIND, (DBINT)0, (BYTE*) i5); dbbind(dbproc, 13, CHARBIND, (DBINT)0, (BYTE*) &family); } while(dbnextrow(dbproc) != NO_MORE_ROWS) printf("%s\n", i5); } Here's the insert statement I use: insert into table1 (id, aid, did, bmonth, bday, byear, dmonth, dday, dyear, dage, gender, orderinlist, i1, i2, i3, i4, i5, family) values (176936, 30256045, 300004, 10, 10, 1824, 2, 5, 1904, 79, 'M', 1, NULL, NULL, NULL, NULL, 'I64', 'Y'); In sqsh I do: select i5 from table1; i5 ---- I64 But the program prints nothing. I appreciate any help you can offer. Steve
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Problem with data type conversions and FreeTDS, James Vanns |
|---|---|
| Next by Date: | More on dblib program, Steven J. Backus |
| Previous by Thread: | RE: Read from SQL server failed. Problem in pool, Lowden, James K |
| Next by Thread: | RE: Need Help on dblib program, Lowden, James K |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |