Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Porting of Sybase Application to Oracle 8i under Solaris

148933Feb 18 2002
Dear All

I want to port an application from sybase 10.2 which is running under Solaris to Oracle 8I under Solaris. Apart from database objects and stored procedures which I have already converted I wan to conver some C Codes and Unix Scripts
Which are either shell scripts or perl programs. I need all of your valuable suggestions in this regard.

Q-1 . In the Perl Program the following lines are sybase specific

Use Sybase:: Dblib
Require /files0/apps/local/lib/perl15/Sybase/sybperl.pl;

What will be the equivalent for ORACLE.
Suggest what perl I should use in this context.

In continuation to the above also I have some shell variables assigned as follows

$SYB_SERVER=SYB_PROD_CERT;
$SYB_DATABASE=APPLDB;
$ENV{SYBASE}=/sybase/10.0.4;
$ENV{DSQUERY}=$SYB_SERVER
$SYB_USER=keshav;
$SYB_PWFILE=/myappl/processcert/passwords/$SYB_SERVER;
$SYB_PW=/usr/bin/cat $SYB_PWFILE;
chop($SYB_PW);

dbmsghandle(message_handler);
dberrhandle(error_handler);

( ($dbproc = &dblogin($SYB_USER,$SYB_PW,$SYB_SERVER)) != -1 );
( &dbuse($dbproc, $SYB_DATABASE) != -1 );

( ($dbproc2 = &dblogin($SYB_USER,$SYB_PW,$SYB_SERVER)) != -1 );
( &dbuse($dbproc2, $SYB_DATABASE) != -1 );

sub Statistics
{
# get distinct sub-cat counts
( &dbcmd($dbproc, "select count(*),orgnumber,name=(select servicerorgname from servicer where servicer.orgnumber=transactionlog.orgnumber) from transactionlog group by orgnumber order by count(*) desc\n") != -1 );
&dbsqlexec($dbproc);
&dbresults($dbproc);
$row = DBROWS( $dbproc );


2. One of the Sample C Program is given here which I want to convert into pro*c.
I would like to know what are the corresponding libraries of oracle under
Solaris are to be used and also the respective header files mapping of Sybase
To Oracle. Any comment of this will be appreciated.


#include "sql.h"
#include "unix.h"
#include <stdlib.h>

#ifndef SQL_INCLUDED
#define SQL_INCLUDED
#include <sybfront.h>
#include <sybdb.h>
/*#include "sybdbex.h"*/
/* #include <syberror.h>*/
#endif


/*--------------------------------------------------------------------------*/
/* LogonToServer(char server[]) */
/*----------------------------------------------------------------------sra-*/
DBPROCESS *LogonToServer(char server[], char datab[], char user[],
char passwd[], char appname[] )
{
PCHAR szTemp;
char data[1000];
int result;
long l;
DBPROCESS *dbp;
LOGINREC *login;

/* initiailize library */
if ( dbinit() == FAIL)
{
printf("DB Initialization failed!\n");
exit(1);
}

/* install user supplied error handling and message handling routines*/
dberrhandle(err_handler);
dbmsghandle(msg_handler);

/* get LOGINREC structure and fill */

login = dblogin();
DBSETLUSER(login,user);
DBSETLPWD(login,passwd);
DBSETLAPP(login,appname);

/* get a DBPROCESS structure for communicating with the server */
if ((dbp = dbopen(login,server)) == NULL)
{
printf("dbopen failed on server: %s\n",server);
exit(1);
}
dbcmd(dbp,strcat("use ",datab));
dbsqlexec(dbp);
result=dbresults(dbp);
return dbp;
}


/*--------------------------------------------------------------------------*/
/* LogoutOfServer() */
/*----------------------------------------------------------------------sra-*/
void LogoutOfServer(DBPROCESS *dbproc)
{
DBPROCESS *dbp2;
dbclose( dbproc );
return;
}

int err_handler(DBPROCESS *dbproc,int severity,int dberr,int oserr,
char dberrstr,char oserrstr)
{
if ((dbproc == NULL))
return(INT_EXIT);
else
{
fprintf(ERR_CH, "DB-LIBRARY error:\n\t%s\n",dberrstr);
if (oserr != DBNOERR)
fprintf(ERR_CH,"Operating-system error:\n\t%s\n",oserrstr);
return(INT_CANCEL);
}
}

int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity,
char msgtext,char srvname,char *procname,DBUSMALLINT line)
{
return 0;
}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2002
Added on Feb 18 2002
0 comments
164 views