• (unregistered)

    <FONT style="BACKGROUND-COLOR: #efefef">I'm assuming SQL2KDBSRV indicates that you're running SQL 2000.  Note that you actually have to go out of your way to set a blank sa password in SQL Server 2000.</FONT>

  • (unregistered)

    Um, I am pretty sure the

    <font color="#009900">(c)</font>
    part means you are supposed to post it on a web site where you serve ads?  I am sure Initech solutions will be pleased!

    [8-)]
    <font color="#009900"></font>

  • (cs) in reply to

    Not to mention that people who write web applications that connect to a database as 'sa' at all should be thrown off the roof of the building, shot, and then immolated...

    If your web app only presents information stored in a DB, then log in with an account that is freaking read-only!  If you write data back into the database, then the account should be read-write but have no rights to create tables or alter schemas.  Connecting as 'sa' for everything is begging for a SQL injection attack [:@]

     

  • (cs) in reply to pjabbott
    pjabbott:

    Not to mention that people who write web applications that connect to a database as 'sa' at all should be thrown off the roof of the building, shot, and then immolated...

    If your web app only presents information stored in a DB, then log in with an account that is freaking read-only!  If you write data back into the database, then the account should be read-write but have no rights to create tables or alter schemas.  Connecting as 'sa' for everything is begging for a SQL injection attack Angry

     

  • (unregistered) in reply to

    Didn't you get the memo about the TPS report cover sheet?

  • (cs) in reply to Mike R

    >unrepeatble grublings about quoting posts<

    To whom I quoted above: Not only that, but also, they're being extra nice to those who wich to compomise the system, sa without a password, "paydirt"

    Anyway, who in their right mind would need to have 8 connections to the same database server. One is all you need, except in the instance that you must connect to multiple servers. Whoever spewed this forth from their keyboard needs to be taken out behind the programming shed and disposed of. Trained monkeys know better.

  • (unregistered)

    I take it that the blank sa password is there for simplicity? And I wonder what this line is meant to close:

    [code language="vb"]objConn.Close[/code]

    And who needs object pooling, anyway?

    --Thomas

  • (cs) in reply to Mike R

    BTW.. what is this hypothetical company "initech"... The name seems vaguely familiar...........

  • (unregistered) in reply to Mike R

    The word "obvious" in the OP is linked to imdb info for Office Space. The company in Office Space is called IniTech.

  • (cs) in reply to Mike R

    Mike R:
    BTW.. what is this hypothetical company "initech"... The name seems vaguely familiar...........

    Never seen Office Space? Check out the link provided by Alex the post right beside the name of the company.

    On the topic of the code: Great merciful crap!  I guess the programmer doesn't believe in re-using objects?!?

  • (cs) in reply to skicow
    skicow:

    [image] Mike R wrote:
    BTW.. what is this hypothetical company "initech"... The name seems vaguely familiar...........

    Never seen Office Space? Check out the link provided by Alex the post right beside the name of the company.

    On the topic of the code: Great merciful crap!  I guess the programmer doesn't believe in re-using objects?!?

    Gah! That's why it seems familiar [:$]

    Yep, seen it, been a long time ago, I need to watch it again [:D]

  • (cs)

    To me, a nice WTF here which is kind of subtle are the variable names, e.g.:

    <FONT color=#000099>Dim</FONT> aryRecordSets(8)

    He's prefixing them with "ary" for Array !!!!  That's is crazy! It's one thing to use that notation for integer's or whatever (don't agree with it, but I can understand it -- espcially in a scripting language), but "Array"??? 

    Maybe the programmer thought "if I want to have more than 1 user on this webpage at at time, obviously I need more connections." ??

  • (cs)

    I'm surprised no one has pointed out VB's ... interesting... behavior when it comes to creating arrays. In most [decent] languages, when you create an array of 8 elements, you then get elements [0] through [7] inclusive. Not VB, nope they had to be different. When he does the

    <FONT color=#000099>Dim</FONT> aryConnections(8)

    What he's actually getting is aryConnections(0) through aryConnections(8), a total of nine elements. He never actually uses that last one. I did this quite often when I was first learning VB, so I'm not free from blame. Not totally.

  • (cs) in reply to Manni
    Manni:

    I'm surprised no one has pointed out VB's ... interesting... behavior when it comes to creating arrays. In most [decent] languages, when you create an array of 8 elements, you then get elements [0] through [7] inclusive. Not VB, nope they had to be different. When he does the

    <FONT color=#000099>Dim</FONT> aryConnections(8)

    What he's actually getting is aryConnections(0) through aryConnections(8), a total of nine elements. He never actually uses that last one. I did this quite often when I was first learning VB, so I'm not free from blame. Not totally.

    That's because VB is derived from BASIC, and different versions of basic did it different ways (either starting at 1 or at 0) but in all cases the final element would be number 8.   One nice feature of VB (pre .NET) is that you could specify the range for your array's elements

    Dim x(-3 to 5)

    dim y(0 to 5)

    dim z(1 to 8)

    and so on ... Also, there's an Option Base statement you can put in your code to set what the base for an array is by default -- either element 0 or element 1.

    So, like usual, it is in the hands of the programmer how they want to handle the situation.  It is perfectly easy and valid in VB to explicitly indicate everything about the arrays you declare; it is up to the programmer to decide whether or not they are going to write clear, well-defined code or not.  (like every other programming language out there)

    We've had discussions before about why C numbers an 8 element array from 0-7, but nothing makes that more "correct" than any other way, or ensure only good code can be written.  (i.e., someone might decide to declare an 8 element integer array as "int abc[9]" in C and use elements 1-8).  It's just a convention of the particular language you are using. It's up to you to understand it and do things correctly as a programmer.

  • (cs) in reply to Mike R

    Mike R:
    BTW.. what is this hypothetical company "initech"... The name seems vaguely familiar...........

    Um... Excuse me but I think you have my stapler... Um, excuse me...

  • (unregistered) in reply to Manni
    Manni:

    <font color="#000099">Dim</font> aryConnections(8)

    getting aryConnections(0) through aryConnections(8), a total of nine elements.



    It's almost as if the VB creators wanted 1-based arrays but decided that index 0 should still work too!

  • (unregistered) in reply to Mike R
    Mike R:
    BTW.. what is this hypothetical company "initech"... The name seems vaguely familiar...........



    "PC Load Letter"? WTF does that mean???
  • (unregistered) in reply to

    While we can't see the rest of the code, if he isn't requiring explicit variable declarations in VB (Option Explicit), maybe the On Error Resume Next is a fix for the mystery objConn connection object not existing.  See... he solved the problem [:'(]

  • (cs)

    no offense here but i actually really cant beleive someone did this. are u running out of wtf's to post?!?!

    If someone really did this then i have no words. just wtf

  • (unregistered)

    Ok, the obligatory defense/justification of the WTF where I prove that I am right, and all you knowledgeable experienced programmers are wrong for laughing at this code.[6]

    Do you notice that round about connection 5, the database changes to marketing, and then to products?

    Obviously there are 8 different databases that this application can connect to, and thus a connection to each database is required.  What do you mean 6 of the connections are to the same db?  Thats the scalable bit.  Right now all that data fits under the WWW_SITE database, but if it gets too big we can break it out of that database and put it in a seperate schema, just by changing this file.For instance we create a new DB like USERS or FORUM, which replaces one of the WWW_SITE connections. 

    Its perfectly logical to me.

    I just don't know why it wasn't implemented in javascript!

  • (cs)

    <FONT style="BACKGROUND-COLOR: #efefef">It achieves scalability quicker!</FONT>

    <FONT style="BACKGROUND-COLOR: #efefef">You see, ADO will pool some connections. The this will start pooling those pools. Thats like O(n^2) scalability!</FONT>

    You need double the amount of data, this will enable Four Times faster!

    Its like DDR for your database server.

    Comes with a free set of steak knives!

  • (cs)

    Unroll those loops.... [:P]

    I don't want to know any "exceeded number of connections" problem for this website! Maybe that will convince them to buy new machines for new databases, so that this piece of WTF will have a legitimate reason to have all those connections!

  • (unregistered)

    Where did you find this?  I'm guessing the tutorials written by someone at http://www.brinkster.com

  • (unregistered)

    Apart from the zillion open connections, and the blank sa password, the file has a .inc extension which will probably render in plain text when requested (unless it's mapped in iis to the asp engine but I doubt that). All we need is an error message like
    asp error:
    /includes/database.inc
    line x
    and then request that file to see the fuckup, and see the database names and passwords

  • (unregistered)

    As an additional optimisation he's in-lined the code instead of using a for loop for creating the connections and recordsets - must run really fast!

  • (cs) in reply to

    :
    Um, I am pretty sure the <FONT color=#009900>(c) </FONT>part means you are [not] supposed to post it on a web site where you serve ads? 

    I assume that was supposed to be written as I editted it above.

    Anyway, the "(c)" actually doesn't mean anything.  The official international copyright symbol is a C in a (complete) circle.  "(c)" is a C in a broken oval.  It doesn't mean diddley.  Officially, you need the correct symbol  © (in HTML &copy;), or the word "copyright" or the officially approved abbreviation (I think it's "copr").

    Of course, according the the Berne Convention (nearly 30 years old, to which the USA has been a signator for over 20), no readable declaration of copyright is needed at all.

  • (unregistered)

    Ok so nobody's mentioned it but there are 3 different connection strings there in the group of 8 connections, so there may have been some reason to go down the multiple-connections line of thought. I'm not sure it makes sense to actually open all those connections on each page request though. Setting up the connection strings as constants and having some way to "factory" up the connection you need sounds a little better to me...


  • (unregistered)

    Hmm why not this in the footer? [:)]

    <FONT color=#000099>For i = LBound(<FONT color=#000000>aryConnections) To UBound(aryConnections)</FONT>
        Set</FONT> aryConnections(i) = <FONT color=#000099>Nothing</FONT>
    Next 'i

  • (unregistered)

    Never used VB or .NET but I do know that having seperate pools for different requests is a quick and dirty way to achieve performance isolation. Couldn't it be just that ?

Leave a comment on “Scalable Scalability ”

Log In or post as a guest

Replying to comment #:

« Return to Article