- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Yup. I most cases, the C# data access layer will be implementable as a seperate tier. Just call them from the mainframe app via Web Services. If the language is too old to support web services, then SPs might actually be a good solution.
I would never suggest replacing the set operations with procedural operations. However, the logic of which operations to run, in which order, adding activity log records, etc (all the statement level logic) is far easier in C#.
Not in SQL 2000 or earlier.
No, you add two lines of code to each of two existing methods. Done. The database can already persist a password, it won't care that it isn't clear text.
Not all. SQL 2000 has no access to a high level language. As for distribution, you made the assumption that the application only has two physical tiers. In my case, I'd just have to replace the middle tier code, running on a server or server farm.
Admin
Front end developers don't even have a SQL Connectionstring. how are they going to issue raw SQL? All they can do is call the methods I give them. I don't see how a well designed set of SPs is any better in this regard than a well designed set of methods. Sure, a well designed set of SPs is better than a poorly designed set of methods, but that doesn't prove that there is any advantage to SPs.
Admin
Using a DBMS that was worth it's name?
No, thank you. I had my share with Sybase ASE and T-SQL (which I consider an abomination). There are, however systems, where it does make sense to do (almost) everything in SPs (or Packages). It's really not my fault if customers/developers chose something different.
l.
Admin
I picked a cursor example from books online because I knew it had a loop in it. That way I didn't have to make up my own code. It seems you have a *lot* to learn about language since you took my example of SQL having poor looping structures and turned it into a critique of my SQL abilities. I think one of the primary defenses of a beaten debater is "attack the attacker". Looks like I'm doing well.
BTW, back to the original point, SQL is a horrible procedural language.
Admin
BOSH!! 100% disagree. (Direct table access + programmers) = Disaster.
Admin
Steps 4 and 6 don't exist. The tool save the SQL source to be edited at any time.
You have to do 7 and 8 as well...... unless you develop on th production server.
It's also highly like that 5 isn't an "extra" step. Everyone tests.
I get several benefits from a real language-
1. A better development environment. Visual Studio is far better than Enterprise Manager. I like intellisense.
2. A better language. I get to use switch, foreach, for, and a bunch of other constructs.
3. Better security model. Client application have no way to even connect to the database. I subtle but important aspect is dynamic SQL. This is why I switched in the first place.
In our old system, all data access was through SPs. An app user was given the rights to all the SPs and deny direct access to the tables. Sounds good so far. However, whenever we implemented some sort of advanced search feature, it got fun. We had to anticipate every possible combination of search criteria because dynamic SQL doesn't work with this security model. If an SP creates a where clause and tries to use EXECUTE to run the query, it doesn't work. EXECUTE runs in the security context of the user, not the SP. Also, EXECUTE can only run 8000 byte blocks of SQL. It sounds rediculous, but I was regularly hitting the limit on an app with a lot of built-on-the-fly pivot queries (until SQL 2005, that was the only way to do a pivot).
Admin
Jsmith -- if you know SQL, you also know that you almost never need loops. The fact that you feel that looping and cursor use is clumsey or inadequate for your purposes which thereforce leads you to write your data manipulation code in other languages simply means that you arent' a good set-based SQL programmer. there's nothing wrong with that.
I am not quite sure how you came to the conclusion that I don't know SQL because I am pointing this out to you, but if that's the assumption you are making, then I suppose you have every right to your opinion. Ironically, this reminds me of a time a co-worker made negative judgements about my skills in SQL when I told him one time that I had no clue about cursor syntax and I never use them. "You can't even write a cursor!? you've got a lot to learn about SQL" he told me. It was actually pretty funny.
Admin
EXCUSE ME BUT...
If your skill level is such that it takes you longer to develop a stored procedure than to right an embedded select statement, then you should have your rights to the database revoked! There is more to consider here too such as maintenance, security, reusability not to mention performance. Just because they aren't the "cool" new thing anymore doesn't mean their place is no longer valid.
Admin
That's a false dichotomy. There are other options than Direct table access or SPs. A well defined data access layer protects the data as well as SPs.
Admin
jsmith -- Now you are talking about building ad-hoc reporting statements and comparing that to writing data access stored procedures. Those are completely different reasons and different contexts for accesssing the database. Any good, flexible reporting tool will of course need to construct a SQL statement. You are jumping all over the place, changing not only your viewpoint but the context of your arguement. I admire your persistence in defending your position, but you still haven't even techinically stated your position. All you are doing is trying to find ways to disagree with others who are defending stored procedures, or finding ways to refute those who disagree with you. Not to mention being very defensive and (unfortunately) demonstrating a lack of knowledge when it comes to the concept of set-based server-side processing.
Admin
I said you didn't know language..... I meant English. This is the second time you misread my post.
The first was when you took my example and inferred that I liked cursors (I think cursors are evil and I carry evidence of that fact with me to show to anyone that I see writing a cursor)
The second is when you took my statement "you have a *lot* to learn about language" as "you don't know SQL". I never said that. BTW, I still see personal attacks and now dodging the question ("you also know that you almost never need loops"). But still, SQL is a horrible procedural language. Having a standing practice that data access code goes in SPs WILL eventually lead to some procedural logic in T-SQL. My standing practices *never* forsce you to do that. Nor do they prevent you from using SQL (of the embedded variety) whenever appropriate. I think I have the best of both worlds.
Admin
I just keep thinking: SPs are one of the builtin methods to aid the developer in certain task such as providing data integrity. So are constraints. Where would you keep those? Also in the data access layer? Or are you splitting that concept here already?
l.
Admin
Oracle is a database company. Naturally, their middle tier technology (Java and PL/SQL) runs in the database. Microsoft is an application company, their middle tier technology (COM/.Net) used to run outside the database. Now .Net runs in the database just like Oracle. It doesn't make SQL Server 2000 a bad database, it just makes you write applications that cater to the strengths of the environment.
Admin
So if we wouldn't be talking about sqlserver, using SPs for certain tasks would be appropriate, or how should I interpret your statement?
l.
Admin
Normal constraints go in the database. No need to reinvent the wheel, my problem is with some features of SPs, not putting things in the database. However, some complex constraints can't be implemented in the traditional way. For example if a value in table x has to be between values in table y. Then I'd put that rule in my data access layer. Other people here would put that rule in their SPs. I think it would be easier to code and maintain in C# than T-SQL.
BTW, the WebPublishing Wizard is a built-in way to create web page based on data in your database. That doesn't mean you should use it. "It's there" is hardly a good argument to use something.
Admin
I think that's were the argument starts: why reinvent the wheel, when it comes to SPs?
I'd say that depends on the knowledge of the developer - and the requirements. But again, T-SQL is quite a weak excuse for a SP/trigger language, doesn't come even close to something like PL/SQL.
But it's also no argument for not using it either and reinventing the wheel instead.
l.
Admin
Actually, the main case for SPs is the data abstraction layer. Consider that application developers deal mostly in flattened data structures while business databases have hundreds of tables requiring joins of possibly dozens. The data complexity is best managed by the DBMS - that's what it was made for. A data access layer in the middle tier is fine once the data is abstracted out of the database, but if you try to assemble the data in the middle tier you'll get killed by performance and/or impedance mismatches. And no, Hibernate does not help much - it starts to collapse at about the same time as an untrained programmer (in database design), plus it leaves you with extra XML files to manage.
There's also the practical issue of where you find people to do the work, e.g., not many people like to work with both aggregate data and single instantiations. Like it or not, database developers are rare and should have their skills maximized. Making them stuff databases into objects is not good for either, or the furniture. Needless to say, making application developers do database programming is even riskier.
If there is one rule I've learned the hard way, it is:
No SQL outside the database!
Admin
I see a lot of people decrying the stored procedure as unnecessary for whatever reason but I still like the added security of them. If you allow random (code generated) SQL statements to be executed then you are opening your database up to have people execute that code.
I thought that was the ONLY compelling reason to use Stored Procs.
-Dory
Admin
Not so sure I agree that "you should put that in a stored procedure" is always or even often good advice. If you're talking in-house IT, maybe. But for online or shrinkwrap products, there are better ways to abstract your data layer, that don't tie you to a single DBMS.
Admin
Ooh, an Oracle reference! I'm not sure what we're arguing about here, but Oracle's middle tier technology is a separate product (line) similar to Weblogic. It happens to store metadata and state information in its own Oracle database, but as a developer you don't see that.
Using an Oracle database as a middle tier would be a serious mistake. It's the sort of thing we used to do before app servers existed, but nowadays we use real app servers. Think of Oracle as a virtual machine implementing a server; you wouldn't complain about a Unix server running C, or a JVM running Java, so what's wrong with Oracle having a native language?
Admin
That is correct. My problem with SQL SPs is that the language sucks. Therefore, I prefer to not to do anything even moderately procedurally complex in T-SQL. PL/SQL isn't nearly as bad and does have a reasonable feature set.
Admin
No you can have as many physical tiers as you want. But in the ad-hoc reporting scenario you mention, if the logic isn't executed in the database layer, then the data must be pulled to at least the mid-tier to be manipulated - all of the data, however much that is. Is that really the best place to handle data?
You also mention that you can keep the mid tier. Really. Did you work in an environment with a COM based mid-tier at some point and then have to switch it all to .Net? Because that doesn't sound like keeping the mid-tier to me. That sounds like throwing it all away. How long have you had your existing mid-tier that handles data access? My current company has had its stored procedure based data access layer for seven years. It could have been much longer, but that's as old as the company is. The last time I was looking for a job I interviewed with no less than 4 companies that had a COM based mid-tier they were planning on re-doing in .Net. I dunno, keeping all the business logic out of the database sounds good on paper, but the companies I've seen that do that end up redoing their mid-tier in a new technology if they use MS for the mid-tier. Or just leaving it as is. I've seen putting all the logic in the mid-tier work once, fail once, and have the result I just mentioned (stuck in a dead technology) 4 times. I've never seen a problem with maintaining it in stored procedures.
I never said update/insert statements wouldn't execute in the database. Sure they do. I just think it's pointless to push more data out of the database to your app than is necessary when selecting. Maybe I'm reading you wrong and you're putting logic in the sql, but I thought you were saying you did basic reads and all formatting etc in a programming language. And I'm uncomfortable pushing table names from server to server. If your setup is at a good secure hosting facility that's not a big concern, but if it's in-house it is a concern (i.e. your network admin with a traffic sniffer shouldn't be able to find out table names). You also then have all the table names scattered throughout your code for anyone who has access to your dev environment.
Admin
Sorry, when I read language, I thought it was referring to the language we were discussing, SQL. I didn't know that we were discussing English. My bad, I suppose, though I will suggest in the future to be a little more clear.
As for my "personal attacks" against you, I guess I apologize. I don't know where I did it, but if you were offended somehow, then I am sorry.
As for me dodging the question ... what was the question that I dodged? I fully accept that I probably ignored or missed it, so if it was important for the debate that I give an honest answer to it, could you kindly re-ask it so that I may properly respond?
I stand by what I said earlier about your reasoning for avoiding writing code in database in SQL but instead choosing to do so in other languages (i.e., C# or whatnot): if you really knew SQL well, and really understood server-side set based processing, you would never even consider such as practice. If you consider that statement a personal attack, then agian I apologize that you are offended (and I am definitely impressed by your certification!), but unfortunately it happens to be true.
Again, I will suggest that perhaps you should clearly state a position since it appears that it needs clarfying. I am really not sure now, what you are saying. Stored procs are evil? They are good sometimes? It depends who writes them? It depends if the DBA has bad breath or not? They are OK to use and not OK to use based on ... ?
Instead of just arguing for the sake of arguing, state a clear case and let us know your position. Why not give us a quick recap/summary? And, again, don't defend the practice of not using them as being "just as good as using them" as long as you have all these extra tools and whatnot, explain to us the benefits of *not* using stored procedures. I am willing to learn new ideas and new concepts, if you could explain to me the benefits and they made sense, I'd be a fool not to learn from this and listen to your ideas. Unfortunately, keep in mind that the same thing applies to you, in reverse.
Admin
Are you suggesting that there is no other possible way to build an effective data abstraction layer other than SPs? You do realize that even though MySQL isn't exactly the most robust database on the planet, and doesn't even have stored procedures, nobody has started on fire by using it. There are a few well implemented solutions on MySQL that have a well implemented data abstraction layer. Apparently it is possible without SPs.
As for "No SQL outside the database!", isn't "exec" an SQL statement? How do you run SPs? My rule is "No SQL outside the data access layer". Sounds the same as yours, but it doesn't force any specific technology on the problem.
Admin
For i=0 to 5
'do something
Next 'i
Admin
Whenever I hear someone say they can implement a perfectly fine data layer in code I'm reminded of all the MySql developers who said they didn't need transactions because they could just write all of that in their code too. Sure you could..... but why?
I'll second jeff again - what is the benefit to having your sql code outside of the database? What exactly is your data access layer? How long did you spend developing it? How do you enforce your complex value constraints - and how is it any better than an insert/update trigger that does the same thing? The example you gave of any value inserted into table x should be between the min and max values in table y is a trivial trigger to write. I'd also like a example of when you're forced to use procedural structures in sp's. In-memory temp tables aren't great, but eliminate many cases where a cursor might seem needed.
Admin
Taking the points in order:
You can build a data abstraction layer anywhere, theoretically - that's what we did before stored procedures, using C or Ada on the database server. In practice, nowadays, it is tough - the modern OO languages are not built for large volumes of data, and performance and security concerns would lead you to put it on a separate physical tier from the data access layer and "business logic" layer. Or, you could put the data abstraction layer on the database server, which would make the money people wonder why they are paying for DBMS features you're not using.
Forgot that many people think MySQL is a DBMS. It is not - it's a file manager with a SQL-like query language. The "no SQL outside the database" rule does not apply here, because MySQL does not support databases. To make it one you'd have to code basic DBMS functionality like read consistency from scratch, so you might as well write custom data extraction as well.
SPs and exec statements are not SQL, they are from the procedural world. They are much more robust and much less dynamic than SQL, so there are few dangers. There's nothing odd about SP calls I can think of, either - are they any different than other forms of RPCs?
Maybe another practical advantage will help: if all the SQL is in the database, DBAs can find it. Performance of queries is highly variable, especially over time. People who know how to tune queries are generally not the same people who know all the languages and IDEs that middle tier developers use, so the turnaround time for performance tuning is a lot less for SPs.
Admin
Often business logic can be executed either in a middle tier business object, or in an SP.
My "rule of thumb" is that any business logic that requires data from a database be processed in order to decide what, when, or where to modify other data in the same database, or to decide what data should be returned to the front end, should be encapsulated in (and therefore belongs in) an SP. It makes no sense to me to pull a chunk of data down to a middle tier object so I can process it, just to construct another query, or to decide what to update, delete or insert into the same or a different table in the same database.
If the data is necessary for some other business process, or the p[rocessing requires data from multiple data sources, or if a different database needs to be modified, then this process is a candidate for the middle tier. Otherwise, it belongs in the tier closest to the source, the database tier, and that means Stored procs...
Admin
What is this irrational hatred some people have of stored procedures and well structured architecture? C'mon guys, using stored procedures is an absolute no-brainer.
I shudder to think of the WTF code the anti-sp crowd is foisting upon the world. The same code I'm going to have to clean up after the WTF generator moves on to his fortune 500 enteprise architect role.
I really hope you guys get a clue somewhere along the way.
Admin
I am going to say this one more time: who is talking about SQL outside the DB? Look at a freakin' ORM.
I don't write SPs...yet, I dont' write any SQL either. How? OR freakin' Ms. Hibernate, TopLink, nHibernate, Active Record. Even MS has this in Sql Server 2k5 called DataSets. PS. They advocate this approach over SPs as well.
Anyway...read a little more, get more experience, then come back and we'll talk.
Admin
I quite agree - one of the things that hurt Sybase/SQL Server in the competition with Oracle was its stored procs. PL/SQL, being a derivative of Ada, is far better suited to large scale apps. I personally won't touch Sybase or SQL Server because of my distaste for the procedural language options. Well, that and the dirty reads.
Admin
You happened to pick the wrong person for an ad hominem attack. Before stored procs were invented I put a lot of effort into generating Actor and Eiffel code from database metadata, essentially what ORM tools do today. I got farther than Hibernate did - unlike those folks I knew that classes map to relational domains, not tables. What stopped me was not the impedance mismatch, it was performance. The custom relational domains slowed SQL down, and the object overhead precluded using ORM for the most important database operations, e.g., million row transactions.
And yes, I have used Hibernate; in fact, I have seen it fail on 2 medium-sized projects, so I know it is not good for much more than UIs. Amber looks a lot better, because it works with the database instead of against it. Would I use Amber by choice, instead of as a defence against OO bigots? Not sure yet, still playing with it.
Admin
Then add it.
It's one thing to say that SPs introduce no performance advantages over dynamic SQL and argue for SQL-in-C# (etc.) vs SPs. It's quite another to suggest web services. Web services are a massively over-the-top solution to this kind of problem; they're expensive (in performance terms), they're complicated, the APIs vary wildly from language to language, they're new (no legacy programs can use them with any ease, unlike with SPs, where if you can talk to the database you can talk to the SP). They offer no advantages over SPs, and considerable costs.
But that has nothing to do with the topic of using SPs for data insertion and extraction.
Even in SQL Server 2000, XPs are not complicated.
Er, no, you don't. You've got to add it to lots of methods, because you have lots of code hitting the database.
The database is far and away the easiest place to say update users set password = hash(password);
Yes, it does. Not as nice as in 2005, I'll grant you. But it's three, through XPs.
On the contrary. I made the assumption that it has multiple "application" layers and relatively few "data" layers.
Which does nothing to help all your other applications.
Admin
Datasets in SQL2k5 do NOT replace SPs, you still need to specify what should be used to populate the Dataset, (a SQL Statement or an SP), and what should be used to modify database tables for changes in datasets (inserts updates and deletes) that are passsed back to the server... Again, the ADO.Net provider can ijssue SQL, or call an SP.
The use of Datasets is a completely independant issue from the issue of whether to use SPs or SQL.
Admin
It sounds like the lazyloading factor wasn't working properly. All moderm ORMs have this facility and are able to load data when needed, not before. There is a perfomance hit (however slight), but nothing that I am going to get all up in arms about.
I have seen SPs fail on several small projects, several large projects and a whole bunch of medium projects. Though, I have to admit, that was because of the people who were programming the systems. Same could probably be said for hibernate. Now, notice how I never said you can't use SPs to get the job done. As a matter of fact, I think you can. However, I generally think they are a bad idea for a slew of architectural reasons along with team/developer reasons. I do believe a good developer can make proper use of SPs, btu I don't think they are the right solution for 99.9% of their uses...especially when we do have more robust ORMs today.
Admin
So, the 16 year old kid banging out some sql-injection error laden, semi-secure pile of crap in PHP or ASP is producing the finest quality software in the world?
I'd suggest that software development, like most things, is a balance. Go too small, you get crap. Go too big, you get crap. Somewhere in the middle (probably somewhere around 2-20 closely-associated developers) you get the optimum bang for the development buck.
Ironically, you get more profit for the development cost (even as the quality drops significantly) as the company gets bigger, not because the software is better for the amount of money spent on it, but because the bigger company can leverage the same software into more markets and has more marketing clout....
Go figure. Freemarket purists have their heads up their arses.
Admin
Just want to thank you all for a most amusing discussion :) No, I won't tell you my opinion on the matter, better keep out of the line of fire...
Admin
loneprogrammer wrote:
Dude, why were you doing OPTIMIZER=FIRST_ROWS on such a heavy query? ALL_ROWS would've probably been able to do faster joins (merge, hash, whatever) and finish much quicker. Did your users really had to see the first row of results immediatly? Nested Loops is often a Bad Thing.
Admin
Ssomething you can do in Oracle with stored functions that could be hard (expensive) to move to the middle tier:
(Using the same expression for both "group by" and "order by" is pretty useless, it's just here to show that stored functions can be used in both places)
To show that in a less abstract example, let's imagine a dating service that tries to find the best matching couples using a secret formula contained in a stored function called "partner_match":
Admin
You know, that's a great example. Let's say that the function requires procedural processing due to the algorithm; let's assume we cannot process it in a set-based manner using nice SQL statements. We have established that a "real" language like C# is much, much better than T-SQL or P-SQL or any SQL when it comes to writing code in this manner -- as jsmith tells us, in C# he can use switch constructs, better looping, external DLL's, arrays, and so on. Cursors are still almost never required in SQL, but sometimes iterative processing is, so lets assume this algorithm needs it.
(The big difference, of course, is that while a loop might still be needed in SQL, each *pass* through the loop still has the ability to process thousands of rows at once, or to relate different tables through optimized joins, or to use temp tables efficiently as mentioned earlier, and so on -- unlike with pure client side processing in where the algorithm is written in C# and stored procs are not used.)
Well, if this code was written in C#, it would need to bring back *every* row in necessary to calculate the algorithm from the database to process things. And, potentially, make hundreds of calls over and over to the database to bring back other related rows for processing. Then it would need to cache all of its results during calculation, and then sort those results, all at the client -- completely "reinventing the wheel" by ignoring those features which a databse provides. While maybe writing that function was *easier* to do in C#, it results in an application that is much, much less efficient -- sometimes by factors of 1000s (if you've done much cursor-busting in the past, you know this is definitely true). And, if you want to write several reports using that function, you need to be able to call this C# code, which many reporting tools do not allow.
Writing the logic at the database layer, since it is data-related calculation, results in the function being stored in 1 place, no client side cursor is needed, and processing is done on the server. And any client that implements ADO or OLEDB or ODBC or any other standard method of getting data from the database can benefit from the function.
Good example, AmmoQ !
Admin
Yes! Bullet! This is the essence of the SP! Well done! I only wish I could have said it!
p.s. Bullet, say Hi to my pals at California Lutheran University...Go Kingsmen!
Admin
yeah...check out webservices....yet another (and better) way of doing the above and you don't need SPs.
Admin
I know all about web services. but I fail to see how a web service prevents another developer (who may nothing about your web service), from calling the database directly and passing constructed SQL to the query processor that is dependant on table names/structure, field names/layout, or relational constraints. Unless you either didn't understand, or didn't read, my post, nothing about a web service is either equivilent to, (or better) than using SPs to address the issues described in my post.
Admin
How does a developer using a webservice send raw SQL? I'm not sure you understand the technology.
Also, you said this:
"If on the other hand you require all access to go threough well-designed set of SPs, all development must go through them (no logins have select, update or delete permissions on raw tables) Then, you can change, extend, or modify anything in the database without breaking any applicatiomn or middle iier code, because you can modify the internals of the Stored proc and keep it's public interface immutable. "
That is what Webservices can do when you use properly. As a great side benefit, they also can expose alot of that to the world in an API style that you can't do with SPs (two for the price of one). So, yeah, WS are better for the what you were arguing for.
BTW. Stop with the raw SQL debate. It is old and tired. No one is advocating that.
Admin
You know, I was right, you're not reading the posts... The developer can send raw SQL because he DOESN'T HAVE TO USE YOUR WEB SERVICE. He can use ADO.Net, ADO, ODBC, OleDB, etc., etc.,
And if your web service is sending raw SQL, the database must be configured to accept raw SQL, and then all those other mechanisms can ALSO send raw SQL.
Admin
What are you talking about? Just lock out the developers from the db. Duh. I mean, do you think I have access to Google's DB? No...
So, just allow the WS to have access. This is not rocket science.
Honestly, I didn't answer that question because I thought even a marginal developer wouldn't suggest such a thing...oh well...
Admin
In spite of your sarcasm, and implied disresepect, I'll remain professional. Let me explain more clearly. Of course you can't access Google's DB. But Google's developers (at some level of permissions) CAN access the DB. There is no way to restrict raw SQL access to the DB except to restrict it to everyone. Some internal development Manager/administrator can always give HIS developers access... and then they can send raw SQL to the DB. Only if ALL raw SQL access is inhibited can this be prevented. Even then it can be a battle between Database Architectural Designers and developers, (like you), who don't understand, to keep those restrrictions in place. But it's much, much easier to manage and enforce if the restriction is at the door to the database than if it's placed at the door to each and every application database entry point a web service.
On another note, I respectfully suggest you skip the disrespectful sarcasm, it only detracts from your arguments.
Admin
That is just a ridiculous argument to make. At some level, developers actually NEED access to SQL...to trouble shoot, debug, quick report, reverse engineer. That is just common sense.
Now, again, no raw sql in the middle tier because ORMs and SQL is not dirty, just hire a decent developer and have a good DBA.
Admin
So on the one hand, you argue that "What are you talking about? Just lock out the developers from the db. Duh ..."
and on the other hand,
"At some level, developers actually NEED access to SQL..." Can you detect an inconsistency there ?
Seriously, in a development environment I don't care what access level developers have They obviously need a high level of access just to create, and debug the stored procs they must be writing to implement the architectural design I am talking about
... in the production environment, on the other hand, for those purposes you describe, if you absolutely HAVE to allow such access, you can create another login or access account that has read-only priviliges, If you are talking about letting developers have write access direct to the tables in production, (please say it isn't so) then you are operating in an area I refuse to go...
Admin
Web services?
So, instead of exposing a standard set of stored procedures to be efficiently access via ODBC or OLEDB, with data being returned directly from the database, you are suggesting that instead requests for data should be sent to a web server, which then builds a sql statement (or series of sql statements as necessary), and then connects to the database (via OLEDB or ODBC of course). and then passes that SQL to the database (directly accessing tables/views of course), and then returns the results back as a response from the web server to the client (converted to XML, of course), which the client receives as an XML file that is then converted from XML to a standard row/column data table which the client can then use.
Makes sense, I suppose. It sounds really cool and complicated, I know it would impress lots of people, and you get to use some very hip buzzwords and all that. I might suggest throwing AJAX into the mix somewhere as well if possible.