Synchronize a Sybase ASE database sysusers with master..syslogins

ASE, Sybase No Comments »

Not sure who was the original author of this short synchronization script but kudos to whomever it is!

isql -Usa -S server -D my_db -i sync_users.sql

sync_users.sql

EXEC SP_CONFIGURE "allow updates", 1
go

/* delete names not found in master syslogins */
DELETE FROM sysusers
WHERE suid > 1
 and uid < =16383
 and uid > 1
 and name not in
  (SELECT name FROM master..syslogins)
go

/* update sysusers and resync all uids from the existing suids */
IF exists(SELECT 1
   FROM sysobjects
   WHERE name = "sysusers_holding"
    and type = "U")
DROP TABLE sysusers_holding
go

CREATE TABLE sysusers_holding (
 id NUMERIC(6,0) IDENTITY PRIMARY KEY,
 suid INT null,
 uid INT null,
 gid INT null,
 name CHAR(30) null,
 environ VARCHAR(255) null)
go

/* populate the holding table */
INSERT INTO sysusers_holding (suid, gid, name, environ)
SELECT suid, gid, name, environ
 FROM sysusers
 WHERE suid > 1
  and uid < = 16383
  and uid > 1
go

/* update the uids. */
DECLARE syncuser CURSOR FOR
 SELECT name, uid
 FROM sysusers_holding
 FOR UPDATE OF uid, suid
go

DECLARE @name CHAR(30), @uid INT, @suid INT
 SELECT @suid = 9999
  OPEN syncuser
  FETCH syncuser INTO @name, @uid
  WHILE (@@sqlstatus != 2)
  BEGIN
   IF exists(SELECT 1
    FROM master..syslogins
    WHERE name = @name)
    /* got the name - update the uid */
   BEGIN
    SELECT @suid = suid
     FROM master..syslogins
     WHERE name = @name
    UPDATE sysusers_holding SET uid = @suid, suid = @suid WHERE CURRENT OF syncuser

    IF @@ERROR != 0
    BEGIN
     ROLLBACK TRANSACTION
     BREAK
    END

    SELECT @suid = 9999
   END
  FETCH syncuser INTO @name, @uid
  END
 CLOSE syncuser
go

DEALLOCATE CURSOR syncuser
go      

/* now move records over */
DELETE FROM sysusers
 WHERE suid > 1
  and uid < =16383
  and uid > 1
go

INSERT INTO sysusers
 SELECT suid, uid, gid, name, environ
 FROM sysusers_holding
go

/* sp_helpuser will show any mis-matches) */
EXEC SP_HELPUSER
go

EXEC SP_CONFIGURE "allow updates", 0
go

Listen to this podcast Listen to this podcast

Introducing….. SweeperBot!

Perl, Windows, misc No Comments »

SweeperBot is an application written by Paul Fenwick that plays Windows minesweeper for you automatically. It’s based upon code orignally written by Matt Sparks.

Get it at SweeperBot.org!

Listen to this podcast Listen to this podcast

Google Video: Introduction to SQLite

Databases, SQLite, Training No Comments »


We are currently using SQLite in production for some smaller projects.

Listen to this podcast Listen to this podcast

I had one! I sold it! I want it back! Amiga 500 promo video (circa 1987)

misc No Comments »


Apparently my wife programmed in Turtle on the Amiga 500 when she was in elementary school (she’s 7 years younger than me).

Listen to this podcast Listen to this podcast

The Sybase TechWave 2008 Presentation Acceptance/Rejection letters are being sent now!

Databases, Sybase, TechWave 2 Comments »

I submitted two presentations, which I didn’t think would get accepted due to their subject matter… they didn’t get accepted. Please don’t think I’m disappointed or upset.  Personally, I’m rather pleased as I can make them into proper magazine articles.  :)  Yes, there is a new magazine in the works.

21200: Understanding RepAgent to Replication Server Communication by Creating Your Very Own RepAgent

21201: Running Sybase ASE in a Virtual Environment

Dear Jason,

Thank you for your Sybase TechWave 2008 abstract submission. There were a
tremendous number of excellent presentation ideas, and it was extremely
difficult to decide among the submissions.

We greatly appreciate the effort you made to develop your presentation and
to submit the application, but we are unable to include your suggested
session(s) in the agenda at this time. We encourage you to submit an entry
again next year.

The TechWave registration site is now live. Please visit the site at
http://www.sybase.com/techwave/registrationinfo by June 29th, to register
and to receive the early bird discount $1,295.00 rate.

We look forward to seeing you in Las Vegas this August. If you have any
questions, please contact Michele Shannon at (781) 251-7705 or at
SybaseSpeakers@experient-inc.com.

Sincerely,

Michele Shannon
Sybase TechWave Speaker Manager

Listen to this podcast Listen to this podcast

Canon Pixma MP150 printer maintenance codes

Gadgets, misc No Comments »

Taken from the Canon Pixma MP150 manual but here in a nice convenient place:

Press the Maintenance button (icon of a pliers & screwdriver) until the code you want shows up then press the Color or Black button:

Code Meaning
A Print nozzle check pattern (prints nozzle patterns on paper)
H Cartridge cleaning (uses a little bit of ink)
F Deep cleaning (uses a lot more ink - use rarely)
P Align print head (prints alignment lines on paper)
U Read in print head alignment sheet (P) and auto aligns print heads
B Clean print rollers (can prematurely wear out the rollers - use rarely)
J Clean bottom plate
1 ????

Does any one know that the “1″ code is?

Listen to this podcast Listen to this podcast

My daughter, Miriam is teething!

humor No Comments »


Teething Miriam likes to suck on fingers, see how she takes the flavors of a Louisiana style shrimp boil!

Listen to this podcast Listen to this podcast

Why I won’t be moving to Wordpress.com

Wordpress 2 Comments »

I’ve been looking at switching host providers from Yahoo for some time.  I did a test migration to Wordpress.com but discovered that they really don’t seem to get that many people would like to control their own blog.  For a simple blog, Wordpress.com would be fine but you might as well go with Livejournal.com, Facebook or some other blogging system then.  I don’t see what value Wordpress.com offers.

  • No javascript is allowed in widgets:

My code has gone from my widget

If you paste code into a widget, save and when you look again it has gone then the system has removed it.
This is done for security reasons.

Anything that has a line like this:
<script type="text/javascript">
or that uses Form or Input tags for instance is not allowed. There are other tags but the effect is the same - they disappear.

There are no exceptions to this.

  • You can’t add plugins to your wordpress blog:

Where is my plugins tab?

Unfortunately, there isn’t one to be found!

For various reasons we do not permit the uploading and use of plugins here at wordpress.com.

The hosting is simply for your blog even if you would pay $$ for email services.  Sure, they have a hack that will allow you to redirect to Google Apps but you might as go with Google’s Blogger then.  Perhaps I’m just not getting the point of Wordpress.com (not to be confused with Wordpress.org).  Can someone enlighten me?

Listen to this podcast Listen to this podcast

Sybase Sysam License Type Codes

Databases, Sybase 2 Comments »

Yuval Malchi over on the ISUG sybase-l mailing list provided the following codes for Sybase’s Sysam (FlexLM):

License Type What the License Type Represents
SS Standalone Seat
DT Development and Testing
MB Mainframe Base
MU Millions of Service Units
CP CPU License
FL Floating License
IC Internet Access License
AP Application License
SR Server License
CL Cluster License
ST Networked Seat
CU Concurrent User License
SF Standby CPU License
SV Standby Server License
SC Standby Concurrent User
OT Other

The following License Types are only available for specific Partner contracts with OEM or embedded license arrangements:

License Type What the License Type Represents
AC Application Deployment CPU
AR Application Deployment Server
AS Application Deployment Seat
AU Application Deployment Concurrent User
AO Application Deployment Other
BC Application Deployment Standby CPU
BR Application Deployment Standby Server
BU Application Deployment Standby Concurrent User

Listen to this podcast Listen to this podcast

Wordpress, MySQL and a bit of corruption caused the tags & categories to disappear

Databases, MySQL, Wordpress No Comments »

Sometime early this afternoon, the categories & tags of my blog disappeared. After a little bit of investigation (I was working quite heavily at the time), I discovered that the wp_term_taxonomy table in MySQL contained minor corruption. I ran repair table ‘wp_term_taxonomy’ and it was corrected.

Listen to this podcast Listen to this podcast

tricky: Getting Sybase ASE 12.5.4 to run on Linux PowerPC 64bit

ASE, Databases, Linux, OS, Sybase, Uncategorized 1 Comment »

For the past few days, we’ve been struggling with getting Sybase’s ASE DBMS to start on our new Linux PowerPC (a virtual machine running on top of AIX). We were able to install the software with no problems. We weren’t able to get past the __gxx_personality_v0 error:

symbol lookup error: /opt/ibmcmp/lib64/libibmc++.so.1: undefined symbol: __gxx_personality_v0

The error is a linking issue with IBM’s Visual Age runtime (a c/c++ runtime). I was able to confirm with Sybase that ASE will NOT run with Visual Age 8.x or 9.x and that it requires the 7.0 runtime. I downloaded the 7.0 runtime from IBM’s website but still received the same error.

ASE’s linking looked okay however:

[sybase@sybase ASE-12_5]$ ldd -v bin/dataserver
libbtsymbols.so => /sybase/ASE-12_5/lib/libbtsymbols.so (0×0000008000002000)
librt.so.1 => /lib64/tls/librt.so.1 (0×0000008000647000)
libm.so.6 => /lib64/tls/libm.so.6 (0×0000008081560000)
libnsl.so.1 => /lib64/libnsl.so.1 (0×0000008000674000)
libdl.so.2 => /lib64/libdl.so.2 (0×0000008081510000)
libibmc++.so.1 => /opt/ibmcmp/lib64/libibmc++.so.1 (0×00000080006a4000)
libpam.so.0 => /lib64/libpam.so.0 (0×00000080006b7000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0×00000080006d3000)
libaio.so.1 => /lib/libaio.so.1 (0×00000080006ff000)
libc.so.6 => /lib64/tls/libc.so.6 (0×00000080812f0000)
/lib64/ld64.so.1 (0×00000080812b0000)
libaudit.so.0 => /lib64/libaudit.so.0 (0×0000008000711000)

I worked with Sybase & IBM to track down the cause but it was IBM’s Brian Shen that was able to identify the culprit. We need to preload the libstdc++.so.5 library:

export LD_PRELOAD=/usr/lib64/libstdc++.so.5

Once we did that, we verified that the library was being picked up:

[sybase@sybase install]$ ldd $SYBASE/$SYBASE_ASE/bin/dataserver
/usr/lib64/libstdc++.so.5 (0×0000008000002000)
libbtsymbols.so => /sybase/ASE-12_5/lib/libbtsymbols.so (0×0000008000146000)
librt.so.1 => /lib64/tls/librt.so.1 (0×000000800078c000)
libm.so.6 => /lib64/tls/libm.so.6 (0×0000008081560000)
libnsl.so.1 => /lib64/libnsl.so.1 (0×00000080ef740000)
libdl.so.2 => /lib64/libdl.so.2 (0×0000008081510000)
libibmc++.so.1 => /opt/ibmcmp/lib64/libibmc++.so.1 (0×00000080007ba000)
libpam.so.0 => /lib64/libpam.so.0 (0×00000080ef6a0000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0×00000080007cd000)
libaio.so.1 => /lib/libaio.so.1 (0×00000080007fa000)
libc.so.6 => /lib64/tls/libc.so.6 (0×00000080812f0000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0×000000800080b000)
/lib64/ld64.so.1 (0×00000080812b0000)
libaudit.so.0 => /lib64/libaudit.so.0 (0×00000080ef6c0000)

If you receive the following error, you can safely ignore it:

ERROR: ld.so: object ‘/usr/lib64/libstdc++.so.5′ from LD_PRELOAD cannot be preloaded: ignored

Don’t forget to set up your environment to include the IBM Visual Age runtime:

export LD_LIBRARY_PATH=/opt/ibmcmp/lib64:${LD_LIBRARY_PATH}
export PATH=$PATH:/opt/ibmcmp/lib64

Listen to this podcast Listen to this podcast

35383: DBD::Sybase calls the broken sp_tables stored procedure

ASE, DBI, Databases, Perl, Sybase No Comments »

35383: DBD::Sybase calls the broken sp_tables stored procedure

Centos 5
Linux dba-dev1 2.6.22.9-default #1 SMP Mon Oct 1 11:26:48 CDT 2007 i686
athlon i386 GNU/Linux

Perl v5.8.8 built for i386-linux-thread-multi
DBD::Sybase 1.07 but 1.08 also has the problem.

Due to Sybase CR 497173, sp_tables can not be relied upon to retrieve
table information correctly for ASE 15.

(ASE 15 stored procedure “sp_tables” doesn’t work with SQL UDFs)

We need to query the system tables instead. Obviously, the below code
would work in v12.0 and higher. A temp table could probably be used for
prior to 12.0 for the TABLE_TYPE to be filled correctly.

$ diff ../DBD-Sybase-1.07/Sybase.pm Sybase.pm
218c218
< my $sth = $dbh->prepare(”sp_tables $table, $schema, $catalog,
$type”);

> # my $sth = $dbh->prepare(”sp_tables $table, $schema, $catalog,

$type”);
219a220,238
> my $sth = $dbh->prepare( q{
> select TABLE_QUALIFIER = db_name()
> , TABLE_OWNER = u.name
> , TABLE_NAME = o.name
> , TABLE_TYPE =
> case o.type
> when “U” then “TABLE”
> when “V” then “VIEW”
> when “S” then “SYSTEM TABLE”
> end
> , REMARKS = NULL
> from sysobjects o
> , sysusers u
> where o.type in (’U', ‘V’, ‘S’)
> and id >99
> and o.uid = u.uid
>
> });
>

Listen to this podcast Listen to this podcast

35381: SQL::Translator::Parser::DBI::Sybase needs to strip the carriage return from stored procs/views sql

ASE, Databases, Perl, Sybase 1 Comment »

35381: SQL::Translator::Parser::DBI::Sybase needs to strip the carriage return from stored procs/views sql

Centos 5
Linux dba-dev1 2.6.22.9-default #1 SMP Mon Oct 1 11:26:48 CDT 2007 i686
athlon i386 GNU/Linux

Perl v5.8.8 built for i386-linux-thread-multi
SQL::Translator::0.09000

Sybase ASE will often store the SQL text for stored procedures and views
with the carriage return embedded (\r). We need to strip that out else
we will receive “^M” in the output.

Sybase_orig.pm Sybase_new.pm

108a109

>

109a111,112

> $stuff->{view}->{$_->[0]}->{text} =~ s/\r//g
> if (defined ($stuff->{view}->{$_->[0]}->{text}));

155a159,161
> $stuff->{procedures}->{$_->[0]}->{text} =~ s/\r//g
> if (defined ($stuff->{procedures}->{$_->[0]}->{text} ));
>

Listen to this podcast Listen to this podcast

SQL::Translator::Parser::DBI::Sybase bug (35380) causes script to fail when sp_helpindex doesn’t return a result set

ASE, DBI, Perl, Sybase 1 Comment »

35380: SQL::Translator::Parser::DBI::Sybase fails when sp_helpindex is empty

Centos 5
Linux dba-dev1 2.6.22.9-default #1 SMP Mon Oct 1 11:26:48 CDT 2007 i686
athlon i386 GNU/Linux

Perl v5.8.8 built for i386-linux-thread-multi
SQL::Translator::0.09000

Sybase ASE’s sp_helpindex will normally return a result set containing
the column “INDEX_NAME” which parse() requires. When no index exists,
sp_helpindex returns a error string similar to “Object does not have any
indexes.” but no result set.

The following workaround simply wraps the selectall_hash with an eval,
if the eval results in no error, then try to use the hash.

$ diff Sybase_orig.pm Sybase_new.pm
252,259c252,259
< my $h = $dbh->selectall_hashref("sp_helpindex
< $table_info->{TABLE_NAME}"
, ‘INDEX_NAME’);
< foreach (values %{$h}) {
<                     my $fields = $_->{‘INDEX_KEYS’};
< $fields =~ s/\s*//g;
<                     my $i = $table->add_index(
< name   =>
< $_->{INDEX_NAME},

>                 my $h;
>                 eval { $h = $dbh->selectall_hashref("sp_helpindex $table_info->{TABLE_NAME}", ‘INDEX_NAME’) };
>                               unless ($@) {
>                   foreach (values %{$h}) {
>                       my $fields = $_->{‘INDEX_KEYS’};
>                       $fields =~ s/\s*//g;
>                       my $i = $table->add_index(
>                                                 name   => $_->{INDEX_NAME},
262,263c262,263
< if ($_->{‘INDEX_DESCRIPTION’} =~ /unique/i) {
< $i->type(‘unique’);

>                       if ($_->{‘INDEX_DESCRIPTION’} =~ /unique/i) {
>                           $i->type(‘unique’);
265,276c265,277
< # we could make this a primary key if there
<                         # isn’t already one defined and if there
<                         # aren’t any nullable columns in thisindex.
<
<                         if (!defined($table->primary_key())) {
< $table->primary_key($fields)
< unless grep {
<                                     $table->get_field($_)->is_nullable()
< } split(/,\s*/, $fields);
<                         }
<                     }
<                 }

>                           # we could make this a primary key if there
>                           # isn’t already one defined and if there
>                           # aren’t any nullable columns in thisindex.
>  
>                           if (!defined($table->primary_key())) {
>                               $table->primary_key($fields)
>                                   unless grep {
>                                       $table->get_field($_)->is_nullable()
>                                   } split(/,\s*/, $fields);
>                           }
>                      }
>                  }
>               }
 

Listen to this podcast Listen to this podcast

Ubuntu 8.04 Hardy Heron has been released! :)

Linux, OS 1 Comment »

Ubuntu 8.04 LTS Desktop:

http://releases.ubuntu.com/8.04/ubuntu-8.04-desktop-i386.iso.torrent i386
http://releases.ubuntu.com/8.04/ubuntu-8.04-desktop-amd64.iso.torrent AMD64

Kubuntu 8.04 LTS Desktop:

http://releases.ubuntu.com/kubuntu/hardy/kubuntu-8.04-desktop-i386.iso.torrent Kubuntu x86
http://releases.ubuntu.com/kubuntu/hardy/kubuntu-8.04-desktop-amd64.iso.torrent Kubuntu AMD64

Ubuntu 8.04 LTS Server:

http://releases.ubuntu.com/8.04/ubuntu-8.04-server-i386.iso.torrent i386
http://releases.ubuntu.com/8.04/ubuntu-8.04-server-amd64.iso.torrent AMD64

Listen to this podcast Listen to this podcast

Is Sybase’s ASE SQL92 (ANSI SQL2) or SQL99 (ANSI SQL3) compliant?

ASE, Databases, IBM DB2, Microsoft, MySQL, Oracle, Postgres, SQL Server, SQLite, Sybase No Comments »

ASE implements a subset of SQL 92 and isn’t 100% compliant with the SQL 92 standard (no DBMS on the planet is btw).

SQL99 compliance isn’t seriously being looked at by the major commercial DBMS vendors. Disregarding the fact the the SQL standards aren’t all they are cracked up to be, the vendors have too much invested in their own proprietary SQL variants (and other components) to be 100% compliant. If they were 100% compliant with the SQL92/99/whatever standard, then wholesale migrations from one vendor to another would take place.

I believe as time goes forward the opensource DBMSs (PostgreSQL, MySQL, etc) may become far more compliant with the standards than the commercial vendors as vendor lock in doesn’t mean as much to them.

Look into what the vendors (Oracle, MS, IBM,etc) are saying what constitutes as “compliance”. Ask each vendor what parts of the SQL99 standard they will be implementing and which parts they won’t be. If any vendor says that they are 100% compliant with the SQL92 or SQL99 ANSI standard, then that particular person is lying to you. Granted, that person may have been told their DBMS was 100% compliant and believes it. An honest vendor says that they comply with features X,Y and Z of the SQL 92 or SQL 99 standards.

Personally, I have found no significant movement by any of the commercial DBMS vendors to implement the SQL99 standard. So far it has just been lip service IMHO.

Listen to this podcast Listen to this podcast

Sometimes I get tired of some people b*tching about Linux

Linux, OS No Comments »

My favorite Linux ads - sorry for all the videos the last two days:

Listen to this podcast Listen to this podcast

Passover: Tomorrow at sundown we feast (1st seder of Passover)

Events, News No Comments »

Listen to this podcast Listen to this podcast

Just because I can: Discovery Channel: I Love the World

misc No Comments »

Discovery Channel: I Love the World

Listen to this podcast Listen to this podcast

FW: Wordpress vs. Drupal: Not that it’s about winning

Wordpress 1 Comment »

Selena over at Tending the Garden, posted a very good video of why you would choose Wordpress or Drupal. It seems a little slanted towards Drupal but that may just be me ;-)

Listen to this podcast Listen to this podcast
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in
Close
E-mail It