Slashdot Mirror


MySQL Gets Functions in Java

Java Coward writes "Eric Herman and MySQL's Brian "Krow" Aker have released code to allow the DBMS MySQL to run Java natively inside of the database. The code allows users to write functions inside of the database that can be then used in SELECT/INSERT/UPDATE statements. So when will someone do Ruby?"

66 of 318 comments (clear)

  1. Now how about. by DAldredge · · Score: 5, Interesting

    Now how about a way to do online backups of the new table types with out having to buy a license to do it?

    1. Re:Now how about. by jamie · · Score: 5, Informative

      Replicate to a slave DB that isn't used for anything but backups. On the slave, you can do a 'mysqldump -x'. That'll block updating while it does the write, but you won't care. The only problem arises if your hardware is too slow to catch up replication before the next time you do the dump, in which case you're kind of screwed anyway. This works on both myisam and innodb tables.

    2. Re:Now how about. by DAldredge · · Score: 2, Insightful

      If you have have a second system to run as a slave that may work. In quite a few realworld(tm) situations you don't have that luxury.

      There needs to be someway of doing online back ups of MySQL with out spending money.

    3. Re:Now how about. by Cajal · · Score: 3, Informative

      There needs to be someway of doing online back ups of MySQL with out spending money.

      Why not just use PostgreSQL? It's had hot-backup of tables for years.

    4. Re:Now how about. by vt0asta · · Score: 2, Informative

      Number one big time issue is how do you get the changes that occured to the files during the backup so that the database is consistent.

      It's trivial really. Announce to the database that you want to perform an online backup. This marks the database in a special mode that lets it know that data writes are going to be at the block level vs. row level.

      Also data modifications are still written to the datafiles and also are always written to special files (simultaneously and at the sime time :-p). These files are called redo logs, and the database cycles through a set of them. When a database is running in a condition in which it can allow online backups, it writes a copy (called an archive) of the redo log file to a special directory before that redo log file is used again.

      During an online backup you backup all of the "archived" redo log files for the entire time it takes you to backup the data files. Once you backup the datafiles, and the archived redo log files, you can then take the database out of backup mode, and start doing row level modifications again.

      When it's time to restore, the database sees that the restore datafiles are in an incosistent state but that's "ok", because it also knows you have competently saved all of the "missing" changes. The database rolls through the archived log files applying the changes that are neccessary until the database is in a consistent state.

      --
      No.
    5. Re:Now how about. by HarrisonFisk · · Score: 2, Informative

      You actually can take online backups of InnoDB without buying the InnoDB Hot Backup tool. The non-free tool allows you to take online *binary* backups, but if you want to take an online data backup you can do so using mysqldump with the --single-transaction method. This will work basically identical to how you take the online backup with pg_dump. It takes a snapshot in time using the normal transaction isolation level semantics and dumps it into a plain text file. Keep in mind that dumping the data is slower than doing a binary backup (also for restore) but that is true for any database. If you just need online backup capabilities, it is built in. If you need it to be faster than you can choose to buy the online binary backup feature.

    6. Re:Now how about. by drix · · Score: 2, Troll

      Yeah, fuck paying for a feature that took a lot of work to implement and that you want badly. The nerve of those assholes, charging money for their work.

      A real man would other get off his ass and code it himself, or support the damn developers who do. Note "Bitch on /." is not listed. Free software is turning the world into a bunch of whining ingrates.

      --

      I think there is a world market for maybe five personal web logs.
  2. Hmmmm by cluge · · Score: 4, Insightful

    I wonder how this affects performance especially compared to regular user defined functions? (Available in later releases of MySQL). This is indeed an interesting twist. It certainly can help speed up development of large projects (java works well in a large/many programmer env.) Like a lot of other tools, it remains to be seen how people put this to use. Too often people learn one thing, and like the saying goes, when all you have is a hammer, every problem looks like a nail. Lets see where this goes shall we?

    --
    "Science is about ego as much as it is about discovery and truth " - I said it, so sue me.
  3. Apparently somebody already did by GillBates0 · · Score: 2, Informative
    So when will someone do Ruby?

    MySQL Ruby Interface
    Google Cache here.

    Google's your friend

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
  4. database language? by Anonymous Coward · · Score: 5, Funny

    So when will someone do Ruby?
    Warning, engaging humor mode *puts on asbestos suit just in case*

    After someone does perl and python ?

    (notice that both of those languages, as well as tcl, are already included in the other free database project: postgres)

  5. judf uses the Java Native Interface... by tcopeland · · Score: 4, Informative
    ....to start up the Java VM. From judf.cc:
    // Create the Java VM
    jint res = JNI_CreateJavaVM (&jvm, (void **) &env, &vm_args);
    Embedding a Ruby interpreter would reduce startup time, probably.
  6. My bad by GillBates0 · · Score: 3, Insightful

    The above interface allows you to use MySQL via Ruby. What's required here is the converse.

    --
    An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
  7. Re:Keep this out. by gustgr · · Score: 4, Insightful

    I don't know why everybody wants to keep distance from Java. It is a very nice language implementing the very well the OOP paradigm.

    The 'lusers' may not use this new feature but Java programmers will and hopefully will enjoy it.

  8. Sounds like... by AndroidCat · · Score: 3, Insightful
    More code to bog down the servers with. I don't know if I see the need for Java inside the DB server. (Sure, server Java between the DB and the client app, but that doesn't require Java inside the DB server itself.)

    I hope this isn't a "Hey wouldn't it be really neat!" feature. The last time that happened, someone at MS thought executable email would really neat.

    --
    One line blog. I hear that they're called Twitters now.
    1. Re:Sounds like... by the+uNF+cola · · Score: 5, Insightful

      We all don't like learning the database language of a database. It's annoying that oracle, sybase, postgresql and mysql support different sets of ansi92 (or 98) sql, but they all have different gotchas..

      limiting the # of rows of output is different between oracle, sybase and postresql/mysql.

      None of them even have remotely the same stored proc language. Of course, everyone may embed a different language, but java seems to be a more common one.

      Now when you go from sybase to oracle, you don't have to worry so much about the stored procedure code, since it'd all be in java anyway.. riight?

      --

      --
      "I'm not bright. Big words confuse me. But Wanda loves me and that should be enough for you." - Cosmo

    2. Re:Sounds like... by MattRog · · Score: 2

      Oracle to PGSQL is a much better choice than Oracle to MySQL.

      --

      Thanks,
      --
      Matt
    3. Re:Sounds like... by GreggBert · · Score: 2, Insightful

      Agreed, however, some of the open source and "developer source" software that I think might be useful to us in the future in our workplace only works with MySql, out of the box. That and the fact that up until recently, PG was not available on Windows which, unfortunately, is one of our production platforms.

      --


      If you don't understand anything I post, please accept that I ate paste as a small boy...
  9. That link in your sig. by DAldredge · · Score: 2, Funny

    That is the most useless waste I time I have ever seen!

    Now leave me alone as I am going to spend the next 2-3 hours playing with it. Really Cool.

  10. That's great by j0hndoe · · Score: 5, Insightful

    I used Java stored procedures a lot back when I was working at a .com. For someone who's already using Java its a lot easier than learning each database vendors proprietary language. It's also good for keeping MySQL feature competitive with open source dbs, since Java stored prcedures have already been implemented for PostgreSQL

    1. Re:That's great by Brento · · Score: 2, Insightful

      I used Java stored procedures a lot back when I was...

      Just FYI - MySQL still doesn't support stored procedures, let alone Java inside stored procedures. Seems like MySQL is trying to run before it's gotten the walking thing down yet.

      --
      What's your damage, Heather?
    2. Re:That's great by krow · · Score: 3, Informative

      Stored Procedures are in 5.0.

      --
      You can't grep a dead tree.
    3. Re:That's great by Tassach · · Score: 2, Informative
      The fact that /. uses MySQL is irrelevant. ./ is not a mission-critical system -- it too is, at the end of the day, nothing but a toy. It's not a serious business system. There's no significant consequence if a message gets lost or garbled; it doesn't matter that transactions are processed in a certian order; it doesn't really matter if it's security is compromised. In fact, ./ has very minimal requirements and there are a lot of other products which would be equally adequate as well: a flatfile system like maildir, an ISAM system like dBase, or a pseudo-relational database like MySQL or MS-Access. If you're building a toy system, a toy database might be sufficient.

      MySQL lacks several essential features which necessary to implement a proper client/server application -- stored procedures and transactions most of all. Stored procedures are essential for several reasons: security, performance, and efficiency. Stored procedures have better performance because they are pre-compiled; there's significantly less overhead to call an SP than there is to process an ad-hoc query. Stored procedures make programming more efficent because you can write a single, complex set of queries and re-use it across multiple clients.

      Perhaps most importantly, stored procedures have several security advantages. If your database allows ad-hoc queries to run against it, it is vulnerable to an injection attack -- an attacker could potentially run any SQL query he wants against your database (EG: update Account set balance = 1000000 where AccountNumber = 123456). A stored procedure acts similarly to a setuid/setgid program in unix, in that it runs with it's owner's permission instead of the user's. This means that you can allow a user to modify a table in a single, very specific manner that they would otherwise not be allowed to touch. Good security is achieved by defense in depth, and stored procedures give you an additional layer of security.

      If cost is a concern, then there are alternatives to Oracle: Postgres is signifiantly closer to being a real database than MySQL; and there are zero-cost licenses available from several of the commerial database vendors. Most notably, Sybase 11.0.3.3 for Linux is available at no cost for any purpose. While a little dated compared to more recent releases, it is still far more mature than any open-source database. Open-source advocacy (zealotry) should never get in the way of making sound engineering decisions.

      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
  11. Re:Keep this out. by j3110 · · Score: 4, Insightful

    Did you not think about that post? Sounds like you just dislike Java so much that hearing it in the same sentance as MySQL makes you cringe.

    1) Java isn't going to slow down any queries unless you use Java functions.
    2) What do you care that someone else isn't smart enough to write good software?
    3) MySQL as it stands has no other way to really embed functions easily, and it's actually more effecient to run code on the server and transfer data back afterwords.

    --
    Karma Clown
  12. Re:waaaaiiiit a minute... by tcopeland · · Score: 3, Informative
    > you are storing java functions/objects
    > in the database?

    Nope, they're external to the DB.

    > program your own functions like
    > insert/modify/etc in java

    You can program functions in Java, and then call them from MySQL queries. From the README:
    To run the sample Java DBMS function
    mysql> SELECT judf("test/GreenBar", COLUMN1, COLUMN2) FROM foo;
    Nifty!
  13. Production Quality OpenSource! by Anonymous Coward · · Score: 3, Funny

    Yay, this project has finally hit Alpha 3 version 0.1, which means that it's the closest OpenSource project yet to a 1.0 release.

    Yes, I'm being sarcastic, I just think it's hilarious that someone would post this implying that the code is anywhere near done. It's barely beyond a twinkle in some kids eye.

  14. Java in the DB - very, very bad idea by BigGerman · · Score: 3, Insightful

    The ability to write stored procedures in Java has been in Oracle for some time but I still cannot figure out why anyone would do that.
    Java is a nice programming language. Go write web apps, middleware, network software, desktop apps with it but not stored procedures.
    Is mySQL process going to start the whole new JVM on every hit? Or VM is going to run separately and it is bridged somehow (God, not over the network)?
    Now if you ask me, even stored procedures in general become more and more evil.
    And in our age of $50 2Ghz CPUs and Gigabit ehternet the performance is no longer an issue.
    To me, a database is a collection of tables and indexes with referencial integrity, failover and redundancy. It should do just one thing and do it well. Attempts to add features like that seem to be just a marketing thing by their new commercial overlords.

    1. Re:Java in the DB - very, very bad idea by tcopeland · · Score: 4, Informative
      > Is mySQL process going to start the
      > whole new JVM on every hit?

      No. Look at judf.cc. There's a judf_init and a judf_deinit. judf_init starts up the VM and hangs on to it in here:
      static JavaVM *jvm = NULL;
      Seems to make sense - start the VM once, call it as many times as you want.
    2. Re:Java in the DB - very, very bad idea by laird · · Score: 5, Informative

      "The ability to write stored procedures in Java has been in Oracle for some time but I still cannot figure out why anyone would do that."

      Here are some reasons:

      1) Java runs _way_ faster than PL/SQL. This is because lots of people have been working in making Java run very efficiently compared to PL/SQL. I've seen people port from PL/SQL to Java stored procedures justified purely by increased system performance.

      2) It allows for consistent coding between database-resident and application server-resident code. This means that you don't need to train people in two very different languages to get work done.

      3) It allows for code portability between the database and application-server. This lets you tune performance. For example, if you have some code that does tons of database I/O, it may run far more efficiently inside the database rather than accessing the database across a network.

      I don't know how well the MySQL guys integrated Java yet, but in Oracle it's pretty wonderful compared to using their weird, slow, proprietary language.

    3. Re:Java in the DB - very, very bad idea by randolfe · · Score: 5, Interesting

      The knees jerk so fast on /. whenever Java is mentioned, in any context, that I'm surprised someone doesn't have their eye put out.

      Of course there exist myriad reasons why one would prefer to standardize on a common language for DB SPs. Java, in this regard, is the most mature alternative at present. Even the notoriously skeptical Thomas Kyte and the pontificating Steven Feuerstein see the validity of Java in the database at the SP level.

      Of course, *we* can all keep fighting amongst ourselves about such things while Visual Basic and C(flat) become the only languages we have to chose from for everything we endeavor to do.

    4. Re:Java in the DB - very, very bad idea by laird · · Score: 2, Informative

      Well, in my experience Java stored procedures are faster than PL/SQL stored procedures, and Oracle says that that's typically the case, but I don't have benchmarks.

      I agree that the strongest argument for running Java inside the database is because Java ia full featured programming language. Your example with string parsing sent shivers down my spine.

  15. Or Python? by Qa1 · · Score: 2, Insightful
    So when will someone do Ruby?
    Or Python?
  16. Re:Keep this out. by Blackknight · · Score: 4, Informative

    I care because when you have 200 shared hosting accounts on one server all it takes is one idiot to load things down.

    Most of the time we detect who it is and suspend their account, but I still wouldn't want them running java code inside mysql.

  17. So when will someone do Ruby? by Trigun · · Score: 2, Funny

    Give me a bottle of scotch, a phone number, and cab fare.

    And a camera.

  18. Oracle already does this... by XaXXon · · Score: 5, Informative

    The thing no one seems to have mentioned is that Oracle already does this and has for many years. I can't find any docs on it off-hand, but I know you can just drop a .jar file into Oracle and it will let you do similar stuff. This is nice because it lets you use a common language for doing your stored procedures instead of learning a different language for each database (e.g. Oracle uses PL/SQL).

    People who are saying "what's the use of this" or "This is just going to bog down the database" most likely have never worked in the industry. Stored procedures are a very common part of large systems and adding this functionality to MySQL will go a long ways in promoting MySQL use in bigger companies.

    1. Re:Oracle already does this... by KenSeymour · · Score: 3, Informative

      Yes Oracle has this. IIRC so does DB2.

      One place where I worked, they had a bunch of Java stored procedures doing things you could have done in PL/SQL.
      They later re-wrote them because the performance is so much worse.

      There are, however, things it might make sense to do in a Java Stored Procedure. Publishing a message using JMS from a trigger is an example.
      I am not sure if Oracle has created utility packages so you could do it from PL/SQL.
      But having a Java stored procedure in this case would allow you to use the same message class that is used by the subscribers to the message.

      I don't think this will bog down non-Java users of MySQL.

      Years ago, when I was using DB2, I noticed that they had external stored procedures that could be written in nearly any language. C, Java, COBOL, you name it.

      --
      "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
    2. Re:Oracle already does this... by _fuzz_ · · Score: 2, Informative

      The interesting thing about Oracle is that it doesn't use a standard JVM. They call it "way-ahead-of-time" compilation instead of "just-in-time" (JIT). The java bytecode is compiled into native code and optimised at the time the stored procedure is installed. Pretty good idea if you ask me.

      --
      47% of all statistics are made up on the spot.
  19. Re:mysql by wawannem · · Score: 2, Interesting

    I wouldn't say that Java's main advantage is compatablity with almost every platform

    I would say that it is definitely one of Java's advantages. I think this feature is useful from the perspective that more small applications will be written by developers that may not be skilled with SQL coding. Many open source projects start out with one developer, and that single developer might not have an arsenal of skills. That is where this sort of thing helps out, that single developer will now be able to use his/her favorite host-language (if Java is his/her favorite host-language) to solve a SQL problem that he/she may not be capable of solving with SQL. Later on, if/when the project grows, the embedded Java may get removed, but at least something had been released, and the concept gets proven.

  20. Where is MySQL anyways? by Chitlenz · · Score: 5, Interesting

    As an Oracle DBA, at a small company, we're constantly looking for less expensive SOLID alternatives to our traditional Oracle/Solaris approach to the back end.

    When I say solid, I mean is able to handle very large files (excess of 50GB per datafile), has stored procedures and trigger infrastructure (a traditional MySQL weak point, and the main reason we've passed on it so far), an integrated backup system a la netbackup/RMAN, and prefereably a back end compiled scripting solution a la PL/SQL.

    This looks like a sorta kinda solution to the last (PL/SQL alternative), but I'm curious to know about the rest, and also how it performs. Ideally for us, we'd also like to see better clustering and large system support examples in the real world before we embarked onto this particular voyage with.. say a production ERP system.

    Are we talking about a good replacement for Access or for DB2 here?

    Enquiring minds want to know ...

    -chitlenz

    --
    Imagination is the silver lining of Intelligence.
    1. Re:Where is MySQL anyways? by BigGerman · · Score: 5, Interesting

      Postgresql seems to be the ticket.
      I have been doing Oracle work for 12 years and find Postgres easy to learn and quite powerful.
      Certainly ref integrity, triggers and PL/SQL like stored procedures are all there.
      I currently have 80GB PostgreSQL database as a backend for pretty busy websites and it holds well.
      THIS is not a solution, just a proof of concept. I looked at the code and it is not even thread-safe.

    2. Re:Where is MySQL anyways? by jdgreen7 · · Score: 5, Interesting

      We ended up moving all of our scattered Access Databases to MySQL about a year ago, and have never looked back. We still use Access as a front-end to get at the data, and everything has worked beautifully. Using Access gives us a consistent UI for each app, and it's quick and relatively painless to add new apps or features. And, using MySQL for the data is orders of magnitude faster that Access MDB files.

      As far as 'enterprise level' features, MySQL is still missing Stored Procedures, easy 2-way replication, and clustering (there are many projects out there that add these features, but none of them are included in the main branch AFAIK). They keep getting closer with each release, though.

      No, it's not ready to take on Oracle yet, but for mid-size shops (we regularly have 30-50 concurrent users all day from various remote locations), it's a great product. Slashdot runs it, and they seem to be able to handle quite a bit of a load. It's proven itself to me, but then again, I've never played with Oracle or DB2. It has a very active developer base, so things are changing all the time.

      PostgreSQL has more enterprise features, but it's not used as much as MySQL. It seems pretty solid, though. We toyed with a bit, but my boss decided to go with MySQL mainly because he had heard of it before.

    3. Re:Where is MySQL anyways? by jadavis · · Score: 3, Informative

      PostgreSQL has more enterprise features, but it's not used as much as MySQL. It seems pretty solid, though. We toyed with a bit, but my boss decided to go with MySQL mainly because he had heard of it before.

      Yeah, postgres has always had a recognition problem. I like it because of the data integrity features, and the only feature I would really like is point-in-time-recovery (incremental backup, whatever you want to call it).

      It's strange how much recognition matters, even when postgres runs the .info registry, the .org registry, and I think the american chemical society has a database >1TB. I'm a postgres fan, so it's a little disappointing to see it rejected like that. I think it will help a lot when they get the windows port out.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
  21. Re:give me a break by ajaf · · Score: 3, Interesting

    I agree, migrating from another database to mysql is a pain in the ass and impossible, due to the lack of a lot of functionalities you said.
    Postgresql, in the other side, is close to other databases, and migrating to it maybe is a pain in the ass too, but not impossible.
    Last version of Postgresql is really fast, so why should I use Mysql?

    --
    ajf
  22. Re:Keep this out. by Anonymous Coward · · Score: 2, Funny
    Bad enough that none of them know how to write queries properly so they bog down the servers.

    Oh, come on, everyone knows mySQL doesn't support subqueries because they allow a lazy user to slow down the database. You're supposed to do simple queries against the database, and then JOIN the results in your C application. Anyone who can't write a safe, fast JOIN in C is just a bad programmer, and should not be using an enterprise-level RDBMS like mySQL. Go back to FileMaker, you SQLamers!

    (This troll brought to you by mySQL AB, the folks who brought you other hard truths about database programming, such as "Transactions are for sloppy programmers" and "Any relational integrity checking you can do in the DBMS, you can do easier in your application." Remember: Only asshole DBAs believe all that Codd & Date "relational" bullshit.)

  23. Why you would do this . . by database_plumber · · Score: 3, Interesting

    This idea has been around for a while; at least since the late 1980's. The motivation for these kinds of DBMS features is that there are lots of programming situations where SQL's types and expressions aren't powerful enough, and that the language doesn't have a lot of modularity. User-defined functions are supposed to overcome this limitation.

    This kind of feature brings MySQL closer to being an "Object-Relational" database.

    http://en2.wikipedia.org/wiki/Object-relational_da tabase

    From a theory point of view it goes a long way towards implementing the Relational Model's idea of a 'domain' (not just INTEGER, VARCHAR or whatever, but PART_NUM, PERSON_NAME etc). This is supposed to improve the integrity of the data in the database.

    From a practical systems point of view it can have a big performance impact. If you're opening cursors and then looping over some Java code on the client to identify only those result rows that you're interested in, then you're paying a pretty big 'system tax' to transfer the data from the DBMS through the connection and into the external program's address space. Pushing the code (which will have to run anyway) into the DBMS eliminates the transfer overhead.

    The point of the original Postgres was to figure out how you incorporate these features into a query processing framework. Most modern DBMS products have the feature; some of them do a better job implementing it than others.

  24. Re:Keep this out. by Tim+C · · Score: 2, Interesting

    But in most shops employing RDBMS, you have one team that maintains the OS, one team that maintains the database, one team that maintains the network, and finally a team that writes and maintains the actual applications. What the poster is probably worried about is being a DBA when some application programmer uses Java badly and then his boss leans on him, as the DBA, to make the process work faster.

    I work in such a company, as an application programmer. Where I work, it's not up to the DBA to make things run faster - if an application is too slow, it's our problem. True, we can call on the various other people to help us in tracking down the cause of the problem, working out what needs to be done to improve the situation, etc, but ultimately it's our responsibility. It may be that the solution is to increase the spec of the machine(s), or upgrade the network, but we'd still be very much involved in coming to that decision.

    So, as a counter example - from my position as a programmer, I'd be rather upset if my otherwise well-performing code is crippled by an underspecced machine or poorly-configured database. I trust the people responsible to do their jobs properly, though.

  25. Slammer anyone? by bentfork · · Score: 2, Interesting
    Remember the SQLSlammer?
    That was spread (as I recall) because of default passwords not being changed on sample databases. I know lots of people that dont change their default MySql root password. (I tellem but WTF, its their bandwidth...)

    Seems like they are trying bring MySql in direct competition with M$SQL server... ( as a spreader of worms )

  26. simple. by flacco · · Score: 4, Funny
    So when will someone do Ruby?

    i will as soon as i can get her to drink this liter of vodka.

    --
    pr0n - keeping monitor glass spotless since 1981.
  27. Re:Keep this out. by KenSeymour · · Score: 3, Insightful

    The /. crowd keeps hoping Java will go away. They don't want to learn it.

    But it doesn't go away.

    I have noticed that there are several technologies that are held in high regard outside of the Linux/Free Software that are despised within it.

    One is Object Oriented programming. By extension, C++, Java, and UML also fit into this category.
    I wonder how many folks who bash these things have ever actually bothered to learn them?
    It is easier to say that XYZ is "bloated and ugly" than to say "I never learned these things so I can't say how useful they are."
    I also see a lot of "Anyone that does not agree with me is a stupid, clueless, MCSE."

    Name calling is a sign of weak arguments.

    The article is about Java running on the server, behind the scenes. It doesn't "look" like anything.

    I believe server side java is the most common usage of Java. Portability is less of an issue because you control the server environment.
    You can support non-Unix users and still use Unix/Linux for your server.

    --
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
  28. Not my first priority by tacocat · · Score: 2, Insightful

    Java is not my first choice in languages to support in a database language. PL would have at least been more adaptable.

    Unfortunately with the Enterprise Popularity of Java, thanks to a strong Marketing Campaign by Sun Microsystems, MySQL is following the Corporate line of supporting Java regardless. This is a fine example of what may be a mis-direction of the MySQL developers being pushed into a Support the Corporate Enterprise stuff rather then doing good code on a good platform.

    1. Re:Not my first priority by Decaff · · Score: 2, Insightful

      Java not stable or reliable? What planet are you on? Java was designed for stability and reliability. The neatest thing in this context is the SecurityManager, which means you can restrict what it can do within an app server or database, unlike C code or whatever.

  29. PHP UDF by TheTomcat · · Score: 4, Informative

    There's similar functionality s/java/php/g, here:

    http://talks.php.net/show/phpquebec/27
    http://www.sklar.com/page/article/myphp

    S

  30. While we're at it... by karmaflux · · Score: 3, Funny

    I want MS-DOS debug embedded.

    --F 200 L1000 0
    --A CS:100
    xxxx:0100 MOV AX,301
    xxxx:0103 MOV BX,200
    xxxx:0106 MOV CX,1
    xxxx:0109 MOV DX,80
    xxxx:010C INT 13
    xxxx:010E INT 20
    --G


    BWAHAHAH

    --

    REM Old programmers don't die. They just GOSUB without RETURN.

  31. Oh come on, NOT stored procedures by Jhan · · Score: 4, Informative

    This is all about writing functions, like no_null in

    select no_null(oftennullfield)||" "||otherfield from...

    MySQL has always had an expansion framework for adding you own functions to the SQL, it's just that traditionally you had to have a compilable language to do that. Now, you can use Java methods as well. (Still not a bright idea IMHO, but...)

    --

    I choose to remain celibate, like my father and his father before him.

  32. PHP would have been a much better choice by acostin · · Score: 2, Informative

    It's a pity the MySQL guys are trying to reinvent Oracle.

    Java in the database is so 98, that makes me wonder why all companies are trying to conquer the world with the same approach..

    PHP would make just a more natural choice for stored procedures, and the approach in MySQL should be to allow stored procedures, triggers and referential integrity (this should be native like in PostgreSQL).

    It's weak typed and has a pretty standard MySQL api. However, a metalanguage over PHP to minimize the API and to make it transparent would be nice.

    Alexandru

    1. Re:PHP would have been a much better choice by pHDNgell · · Score: 2, Informative

      It's a pity the MySQL guys are trying to reinvent Oracle.

      If that's their motivation, they're missing by far. Postgres is *way* closer to oracle.

      Postgres does have a plPHP as you're describing. I wouldn't say that being a weakly typed language or having a standard API for talking to a particular type of database make for a good language.

      But postgres allows you to make that decision for yourself. Stored functions and procedures may be written in any language and it's easy to plug them in.

      --
      -- The world is watching America, and America is watching TV.
  33. PHP has this for over a year by MelloDawg · · Score: 2, Informative

    PHP Dev David Sklar implemented this over a year ago: http://www.sklar.com/page/article/myphp

    --
    /. is irrelevant.
    1. Re:PHP has this for over a year by repetty · · Score: 2, Insightful

      "PHP Dev David Sklar implemented this over a year ago: http://www.sklar.com/page/article/myphp"

      Cool. Very cool. But those execution times are pretty bad. You certainly would want to plan carefully how you used this.

      --Richard

  34. and here is a great reasons not to by kpharmer · · Score: 2, Interesting

    how many folks can you find who are *experts* good with both SQL & Java? (BTW,I don't mean that they can write simple joins, group bys and unions. I mean good enough to understand access paths and parallelism choices). Of the 100+ java developers I've worked with over the last four or so years I've only met *1* who would meet that critieria. So, exactly who's going to be making the performance-tuning decisions? Nope - bad idea, a simple tuning problem will need a committee to figure it out.

    keep in mind that since we've mostly dropped the idea of writing all business logic in stored procedures, they're primarily being used these days for very simple procedures. Nothing fancy - convert an ip from a string to an integer, etc. You don't need *or want* a big language for this. Nor should you sweat too much that it is proprietary - who cares when you can learn the basics of the language in 5 minutes.

  35. except that for the skill requirements by kpharmer · · Score: 2, Insightful

    No, a stripped-down version of PHP, python, etc would be far better than java.

    Does the LAMP crowd write code in java? nope.

    Do the DBAs write code in java? nope.

    Does the java crowd use mysql? nope (if you're going to the cost of developing apps in java, it makes more sense to use postgresql if not oracle, db2, etc).

    In java you can abstract the data persistence thru a variety of encasulation techniques. All of which creates such a mess than everyone's scrambling these days to figure out how to simplify it. Sounds like a mess to introduce deeper into the database.

    And portability? Do you really think that java functions created for mysql will port *seamlessly* to postgresql, db2, or oracle? No way. And if they don't - why don't you simply write the functions in a tiny, simplistic language that everyone can use easily?

  36. Re:Obligatory comment/troll by jon3k · · Score: 2, Interesting

    Obligatory comment/troll about how much MySQL is not ready for the enterprise eventhough it actually is.

    Spoken like a true linux zealot with absolutely no foundation in relational data management.

    Do you realize that referential integrity is a fairly new feature in MySQL? Do you understand the reasoning behind a transaction based DBMS? How about the simple normal forms layed out by Boyce and Codd?

    Anyone who's done any extensive DB work will tell you how lacking MySQL is. I *love* linux, its the only OS I run at home, and I follow the progress of the MySQL project with an almost religious fervor. I can't *WAIT* until it can compete in a production environment .. but its just not there yet. I'm counting the days until I can get this overpriced trash off our database servers. :(

  37. Re:Keep this out. by phatsharpie · · Score: 2, Informative

    The usage of Java for online animation has really dropped with the growth in Flash. In fact, for a long while I uninstalled the Flash plugin from my browsers because I was so sick of the ads.

    However, Java has become more relevant in the past 3 to 4 years as a server-side language. J2EE is an excellent web application platform, and tremendous growth has occurred in that arena. Also, J2ME is also becoming more relevant with the growth in cellphones and PDAs that supports it.

    -B

  38. Re:Keep this out. by gumbi+west · · Score: 2, Informative
    The other replys have tried to say this but missed the point. This is an add-on. Not a part of MySQL. You will notice it is not distributed by MySQL.

    As they say in my home country, (to be pronounced with a crazy accent) "If you don't want a monkey, don't buy a monkey."

  39. Re:Old hat by ibbey · · Score: 3, Insightful

    Oracle has had this functionality since 8.x. Java is *very* fast inside of Oracle, and is more efficient than PL/SQL in a few cases. Again, OSS is playing catch up.

    SO? Oracle has lots of features that MySQL lacks. The point of the post isn't that this is some wonderful new feature never before seen in the world, only that it's new to MySQL.

    Oh, and one of the fabulous features that Oracle has over MySQL is the price. I mean, who wouldn't prefer to spend many thousands of dollars? This is obviously another area where OSS needs to start playing catch-up.

  40. Embedded Ruby is not thread-safe by jdoeii · · Score: 4, Informative

    So when will someone do Ruby?

    Not soon. Ruby cannot be embedded in a threaded application without using a giant mutex. Only one thread at a time can call Ruby interpreter.

  41. Ruby? by Glock27 · · Score: 3, Interesting
    So when will someone do Ruby?

    Perhaps when there's a Jython-like JVM based Ruby implementation?

    Seriously (given the number of ignorant "why use Java it's so slooooow" posts) as far as I can tell the current Ruby implementations are slow compared to Java. Would you really want to use a slow interpreted language for database functions, rather than one with close-to-C performance?

    Also on the subject of knee-jerk Java bashing, I can't understand why so many C++ programmers resist Java, tooth and nail. Yes, Java has a somewhat bulky memory footprint (that may not be such a problem going forward with all the new 64-bit architectures out there). However, you get a ton of niceties as well, and a very sane language compared with C++. Java runs very fast these days, given sufficient JVM heap. Gcj is also getting there in terms of being useful, and provides an OSS traditional ahead-of-time compiler for Java code. Java may not be an ECMA standard, but it is open enough to permit free implementations.

    Java isn't perfect...but it is better than many of the alternatives, and deserves more respect than it seems to get here on /. and among programmers in general. At least it is well supported on Linux by it's originators, unlike C# and .Net.

    OK, time to do something useful now... :-)

    --
    Galileo: "The Earth revolves around the Sun!"
    Score: -1 100% Flamebait
  42. Re:Krow by krow · · Score: 3, Informative

    Auditing the code should be trivial for anyone (judf is actually quite small).

    I resigned because I had been working on Slash for 3 years and wanted to do something new. I rather like the people who run this site, and still follow the development of it and point out feature improvements from time to time. I no longer develop the code myself, except for a few sites that I happen to help with.

    Just to poke another hole in this, if I was fired would I still be an author on the site some 7 months later? I think not.

    --
    You can't grep a dead tree.