472,111 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

Sybase & PHP

Hi,

I had trouble using FreeTDS with Sybase ASE 12.5.2 DE. I kept getting errors when trying to run a stored
procedure, using the PHP program found at the end of this post.
php: dblib.c:303: buffer_add_row: Assertion `row_size <=
buf->element_size' failed.
Aborted
But now having uninstalled FreeTDS, and trying to connect to my databases, I can no longer connect.
PHP Warning: sybase_select_db(): Sybase: A link to the server could not be established in ...
What do I have to do to connect PHP to Sybase?

I also have downloaded iAnyWhere and installed it, but I don't know if I needed it or not, or if
it can even help.

Very confused. Do I need to re-install FreeTDS or is there a lib already in Sybase?
( Using Sybase ASE 12.5.2 DE )

Thanks in advance!

My last configure command:

../configure \
--with-apache2=../httpd-2.0.53 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-openssl \
--with-mysql \
--with-dbase \
--with-ttf \
--with-curl \
--with-gd \
--with-gnu-ld \
--with-module=so \
--with-zlib \
--with-sqlanywhere=/opt/sybase/SYBSsa9/ \
--with-sybase=/opt/sybase/OCS-12_5 \
--with-mcrypt
Test Program: ( worked fine with SQL but not stored procedures when FreeTDS was installed )

<?php

$servername = "my-server-here" ;
$portnumber = "5000" ;
$username = "sa" ;
$password = "" ;
$database = "master" ;

$db = sybase_connect("$servername:$portnumber","$usernam e", "$password");
sybase_select_db ( "$database" );
$q = sybase_query("sp_server_info", $db);

# $q = sybase_query("${database}..sp_help", $db);
# $q = sybase_query("select * from sysobjects", $db);

$syb_num_fields = sybase_num_fields( $q ) ;
$syb_num_rows = sybase_num_rows( $q ) ;

$row_cnt = 0 ;
$field_cnt = 0 ;

while($row = sybase_fetch_row($q))
{
if ( $row_cnt == 0 )
{
for ( $f=1; $f<=$syb_num_fields;$f++)
{
$info = sybase_fetch_field($q);
print "[$info->name]";
if ( $field_cnt == $syb_num_fields )
{
print "\n" ;
$field_cnt = 0 ;
}
}
print "\n" ;
}

++$row_cnt ;
$field_cnt = 0 ;
while(list($k, $v) = each($row))
{
++$field_cnt;
$datum = NULL ;
$datum = rtrim ( $v ) ;
print "[$datum]" ;
if ( $field_cnt == $syb_num_fields )
{
print "\n" ;
$field_cnt = 0 ;
}
}
}
sybase_close ( $db ) ;

?>

Jul 17 '05 #1
0 1578

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Josh Close | last post: by
reply views Thread by Dave Cole | last post: by
2 posts views Thread by eight02645999 | last post: by
1 post views Thread by db2sysc | last post: by
3 posts views Thread by Alex Murphy | last post: by
reply views Thread by =?ISO-8859-1?Q?S=E9bastien_Sabl=E9?= | last post: by
reply views Thread by =?ISO-8859-1?Q?S=E9bastien_Sabl=E9?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.