Learning JAVA
March 17, 2005 9:34 AM
I would like to start teaching myself JAVA and SQL but I'm not sure where to start in terms of what I need on my computer.
Can I just download the JAVA developers kit, which I believe is free, and are there free versions of SQL? From what I understand, Microsoft has an express beta version of SQL server 2005 available, but will this allow me to both program and administer the database?
Can I just download the JAVA developers kit, which I believe is free, and are there free versions of SQL? From what I understand, Microsoft has an express beta version of SQL server 2005 available, but will this allow me to both program and administer the database?
Oh, here is an article concerning connecting to mySQL via Java's JDBC API.
posted by xmutex at 9:40 AM on March 17, 2005
posted by xmutex at 9:40 AM on March 17, 2005
Yes, download Java. Speaking as a professional database programmer, and having been forced to use MS-SQL server, I'd suggest you use just about anything else except MySQL.
MS-SQL Server has a semi-friendly UI, but the database implementation itself suffers.
Get postgresql. And learn to design databases using scripts, not GUIs -- because scripts work everywhere. (I was able to administer the MS-SQL server in large part because I knew how to admin Sybase and postgresql via scripts. Had I learned a GUI in either, I'd not have found that knowledge transferred to MS-SQL Server.) And learn to design in ANSI SQL (92 or 99) -- because almost all database engines will understand ANSI SQL. Don't become reliant on extensions, because those extensions won't be available on the next database you work on.
If you're serious about writing code, I'd suggest going to the bother of installing Cygwin, and oif running postgresql in Cygwin. While there's a new MS-Windows native postgresql, the Cygwin version is more stable. Plus, Cygwin will give you a plethora of tools that a programmer should have, and that MS doesn't even consider. Soon enough, you'll find Cygwin indefensible for coding.
You'll also want a text editor. Java comes with netBeans, which I've never tried but it's a place to start. Again, don't get dependent on a particular GUI: you'll find that some jobs won't even allow you a programmer's editor, much less an environment. (Freddie Mac, of all places, insisted on coders using emacs via an MS-Windows X terminal, or MS-Notepad.)
And remember, for any database task: first, write a view.
Oh, and it's 'Java"; "JAVA" screams newbie or management.
posted by orthogonality at 9:45 AM on March 17, 2005
MS-SQL Server has a semi-friendly UI, but the database implementation itself suffers.
Get postgresql. And learn to design databases using scripts, not GUIs -- because scripts work everywhere. (I was able to administer the MS-SQL server in large part because I knew how to admin Sybase and postgresql via scripts. Had I learned a GUI in either, I'd not have found that knowledge transferred to MS-SQL Server.) And learn to design in ANSI SQL (92 or 99) -- because almost all database engines will understand ANSI SQL. Don't become reliant on extensions, because those extensions won't be available on the next database you work on.
If you're serious about writing code, I'd suggest going to the bother of installing Cygwin, and oif running postgresql in Cygwin. While there's a new MS-Windows native postgresql, the Cygwin version is more stable. Plus, Cygwin will give you a plethora of tools that a programmer should have, and that MS doesn't even consider. Soon enough, you'll find Cygwin indefensible for coding.
You'll also want a text editor. Java comes with netBeans, which I've never tried but it's a place to start. Again, don't get dependent on a particular GUI: you'll find that some jobs won't even allow you a programmer's editor, much less an environment. (Freddie Mac, of all places, insisted on coders using emacs via an MS-Windows X terminal, or MS-Notepad.)
And remember, for any database task: first, write a view.
Oh, and it's 'Java"; "JAVA" screams newbie or management.
posted by orthogonality at 9:45 AM on March 17, 2005
MySQL isn't a real database until it includes views and stored procedures.
posted by orthogonality at 9:46 AM on March 17, 2005
posted by orthogonality at 9:46 AM on March 17, 2005
Treat yourself to 'Learning Java' by Niemeyer and Knudsen, published by O'Reilly. I found it a great introduction to the language, and it even comes with a CD with all the software you'll need (although, yeah, you can just download the latest versions from Sun).
It does concentrate more on the desktop app (J2SE) side of things rather than the server (J2EE) side of things, though. Judging by the fact that you're talking about SQL, perhaps you're more interested in writing server-side stuff?
posted by chrismear at 9:46 AM on March 17, 2005
It does concentrate more on the desktop app (J2SE) side of things rather than the server (J2EE) side of things, though. Judging by the fact that you're talking about SQL, perhaps you're more interested in writing server-side stuff?
posted by chrismear at 9:46 AM on March 17, 2005
Aw jeez, if mySQL's not a real database, someone might want to tell all of the customers listed here. I mean, this could be a real scandal.
posted by xmutex at 9:53 AM on March 17, 2005
posted by xmutex at 9:53 AM on March 17, 2005
For java development environments, Eclipse and Jbuilder (Foundation edition) are both excellent and free. Both come with a JDK as well.
posted by true at 10:16 AM on March 17, 2005
posted by true at 10:16 AM on March 17, 2005
"Just Java 2" is an excellent book to learn Java from.
From a database standpoint, you don't really learn much from leaning on a fancy frontend to do the heavy lifting. MySQL is fine to learn the basics of SQL, otherwise, you could grab something like MSDE from Microsoft, or PostGresQL, and I think I heard that Oracle has a free copy of its DBMS for personal use.
posted by icey at 10:22 AM on March 17, 2005
From a database standpoint, you don't really learn much from leaning on a fancy frontend to do the heavy lifting. MySQL is fine to learn the basics of SQL, otherwise, you could grab something like MSDE from Microsoft, or PostGresQL, and I think I heard that Oracle has a free copy of its DBMS for personal use.
posted by icey at 10:22 AM on March 17, 2005
For the SQL aspect, I want to point out that you can also download Oracle Database Lite for either Windows or Linux.
posted by vacapinta at 10:24 AM on March 17, 2005
posted by vacapinta at 10:24 AM on March 17, 2005
"learning java and sql" is kind of vague and could take years. what are you trying to do? if it's related to building web sites you might be best downloading both j2se and j2ee and then following the j2ee tutorial on sun's site that covers a basic web app with a small database (i think they ship something like cloudbase free with j2ee to get you started).
posted by andrew cooke at 10:49 AM on March 17, 2005
posted by andrew cooke at 10:49 AM on March 17, 2005
Just wanted to chip in on the MySQL vs Postgres debate; having only been using Postgres for a week now, I can already say that yes, Postgres is more powerful and offers more features than MySQL (even 4.0/4.1) does.
HOWEVER, MySQL is not without merit, simply because it's a bit simpler to set up and administrate, and because of lots of community support (e.g. tons of books, tutorials, code, etc has been written with PHP+MySQL in mind). Granted, it might've been better that Postgres got the attention MySQL did (from the PHP community, at least) way back when, but what's done is done, and for some people, community support > views and stored procedures.
And yes, regardless of whichever you use, LEARN THE SCRIPTING FIRST. It's not really 'scripting' per se, as much as just *learning the SQL language*. Once you have a firm, broad foundation in using the SQL commands manually, using a GUI may speed up some things, but won't ever be necessary. Plus knowing how queries work will make your usage of that GUI interface more efficient.
posted by cyrusdogstar at 10:55 AM on March 17, 2005
HOWEVER, MySQL is not without merit, simply because it's a bit simpler to set up and administrate, and because of lots of community support (e.g. tons of books, tutorials, code, etc has been written with PHP+MySQL in mind). Granted, it might've been better that Postgres got the attention MySQL did (from the PHP community, at least) way back when, but what's done is done, and for some people, community support > views and stored procedures.
And yes, regardless of whichever you use, LEARN THE SCRIPTING FIRST. It's not really 'scripting' per se, as much as just *learning the SQL language*. Once you have a firm, broad foundation in using the SQL commands manually, using a GUI may speed up some things, but won't ever be necessary. Plus knowing how queries work will make your usage of that GUI interface more efficient.
posted by cyrusdogstar at 10:55 AM on March 17, 2005
MySQL has its strengths, but it's idiosyncratic: MySQL expertise is less portable to other SQL-based databases than PostgreSQL expertise would be. Unless, of course, you end up working on MySQL, and, given its popularity, there are plenty of reasons you might be.
Bruce Eckel's Thinking in Java is available for free download.
orthogonality, how is Emacs not a programmer's editor? (I understand being frustrated with having to run something through an xterm, of course.)
posted by Zed_Lopez at 11:08 AM on March 17, 2005
Bruce Eckel's Thinking in Java is available for free download.
orthogonality, how is Emacs not a programmer's editor? (I understand being frustrated with having to run something through an xterm, of course.)
posted by Zed_Lopez at 11:08 AM on March 17, 2005
Zed, I would speculate that orthogonality is, like myself, a Vim man and thus considers emacs to be worse than using Notepad on a Dvorak keyboard layout.
Well, I don't actually have anything against emacs, but there are UNIX conventions to keep up, you know!
posted by cyrusdogstar at 11:21 AM on March 17, 2005
Well, I don't actually have anything against emacs, but there are UNIX conventions to keep up, you know!
posted by cyrusdogstar at 11:21 AM on March 17, 2005
archimago, could you perhaps tell us what you are aiming to do?
If you want to develop some applications that you can use on the web I would start by downloading just Java and learning the structures and language. Eclipse is a great IDE to develop Java in.
Once you have succesfully mastered the basics you have a few options:
For personal and business web-applications get yourself a copy of Tomcat (reference implementation of servlets), and download MySQL or Postgress. (I'm not getting into that debate, but if you are just using it for personal use it really does not matter too much which one you use).
Now you are ready to develop JSP and database connectivity. I find those things great for playing around in.
If you are looking to develop enterprise applications learn how to develop j2ee applications with a Struts framework (reference implementation for j2ee). And then get yourself a copy of Oracle 9i or 10i. I think about 90% of all big companies use at least one instance of Oracle and many applications are built on it. You can download developer editions of Oracle for free. It's just a huge strain on the resources of your pc. (Don't think about running it with 512 MB or less memory).
But the main advice I can give you is to use what most people use, either the IDE or database or Servlet engine. If you want examples or help the applications with the biggest user base have the best peer-support. If you are thinking about using a specific product or library first do a google search like: [product name] java example and see if you can find some example source.
Most of my applications are based on some example of someone else. Until I am really comfortable programming something I always use examples, code snippets. Also in Java as in all programming languages: Open Source is your friend. If you are trying to read a strange file format or connect to some web service someone else probaly tried it before you and maybe put a library in open source.
Good luck, Java is a great language!
posted by sebas at 12:08 PM on March 17, 2005
If you want to develop some applications that you can use on the web I would start by downloading just Java and learning the structures and language. Eclipse is a great IDE to develop Java in.
Once you have succesfully mastered the basics you have a few options:
For personal and business web-applications get yourself a copy of Tomcat (reference implementation of servlets), and download MySQL or Postgress. (I'm not getting into that debate, but if you are just using it for personal use it really does not matter too much which one you use).
Now you are ready to develop JSP and database connectivity. I find those things great for playing around in.
If you are looking to develop enterprise applications learn how to develop j2ee applications with a Struts framework (reference implementation for j2ee). And then get yourself a copy of Oracle 9i or 10i. I think about 90% of all big companies use at least one instance of Oracle and many applications are built on it. You can download developer editions of Oracle for free. It's just a huge strain on the resources of your pc. (Don't think about running it with 512 MB or less memory).
But the main advice I can give you is to use what most people use, either the IDE or database or Servlet engine. If you want examples or help the applications with the biggest user base have the best peer-support. If you are thinking about using a specific product or library first do a google search like: [product name] java example and see if you can find some example source.
Most of my applications are based on some example of someone else. Until I am really comfortable programming something I always use examples, code snippets. Also in Java as in all programming languages: Open Source is your friend. If you are trying to read a strange file format or connect to some web service someone else probaly tried it before you and maybe put a library in open source.
Good luck, Java is a great language!
posted by sebas at 12:08 PM on March 17, 2005
To query your database, whichever one you choose, WinSQL is very good and very free. This is useful since it's easier to write your queries standalone first, before implementing them in code.
posted by smackfu at 12:10 PM on March 17, 2005
posted by smackfu at 12:10 PM on March 17, 2005
MySQL isn't a real database until it includes views and stored procedures.
Well, it does include stored procs now. And I'm fairly certain that kind of opinion should be reserved for impressing the ladies, not for derailing a question about learning SQL. Everyone needs to walk before they run, so views and stored procs aren't all that important here. MS-SQL is fine too. It's a place for sticking data. A text file is fine if you're starting to program.
posted by yerfatma at 12:11 PM on March 17, 2005
Well, it does include stored procs now. And I'm fairly certain that kind of opinion should be reserved for impressing the ladies, not for derailing a question about learning SQL. Everyone needs to walk before they run, so views and stored procs aren't all that important here. MS-SQL is fine too. It's a place for sticking data. A text file is fine if you're starting to program.
posted by yerfatma at 12:11 PM on March 17, 2005
Eek, copy / past took all my links away.
Java: http://java.sun.com
Eclipse: http://www.eclipse.org/
Tomcat: http://jakarta.apache.org/tomcat
Struts: http://struts.apache.org/
Oracle: http://www.oracle.com (Free registration required for download) Also, do not learn SQL with Oracle. Learn it with MySQL or Postgress or something else easy.
posted by sebas at 12:14 PM on March 17, 2005
Java: http://java.sun.com
Eclipse: http://www.eclipse.org/
Tomcat: http://jakarta.apache.org/tomcat
Struts: http://struts.apache.org/
Oracle: http://www.oracle.com (Free registration required for download) Also, do not learn SQL with Oracle. Learn it with MySQL or Postgress or something else easy.
posted by sebas at 12:14 PM on March 17, 2005
BlueJ, the IDE designed for learning beginning Java. Accompanying book.
posted by nakedcodemonkey at 12:57 PM on March 17, 2005
posted by nakedcodemonkey at 12:57 PM on March 17, 2005
Zed_Lopez writes "orthogonality, how is Emacs not a programmer's editor? (I understand being frustrated with having to run something through an xterm, of course.)"
Oh, of course it is, and that built-in Mayan calendar rocks. It's, ah, a great, if quirky operating system. I only wish it had an editor in there somewhere.
But Freddie was paying about $100 an hour for my time (of which I was seeing half), and I wasn't conversant with emacs.
And emacs running on a unix box controlled via an X-Windows terminal emulator on an MS-Windows PC is kinda slow. I'd have been far more efficient with an editor with key-bindings I was used to, and mouse support I was used to. But Freddie, in its wisdom, only approved certain editors, and all of those cost money, and while they had money to pay for my time, it was a political issue to buy a license for an editor, so could you just use Notepad or emacs please because you can't download any of those free OSS editors because the Y2K people haven;'t approved them and even though it's after Y2K, see the policy is in place and we can't go around policy. and sure, you're working on code but since you're a consultant the secretaries get first dibs on new machine so you'll have to use this out-of-date machine because otherwise the employees would feel put out, ok?
emacs is great if you want to use emacs. If you don't, it's yet another thing to acclimate to.
posted by orthogonality at 12:59 PM on March 17, 2005
Oh, of course it is, and that built-in Mayan calendar rocks. It's, ah, a great, if quirky operating system. I only wish it had an editor in there somewhere.
But Freddie was paying about $100 an hour for my time (of which I was seeing half), and I wasn't conversant with emacs.
And emacs running on a unix box controlled via an X-Windows terminal emulator on an MS-Windows PC is kinda slow. I'd have been far more efficient with an editor with key-bindings I was used to, and mouse support I was used to. But Freddie, in its wisdom, only approved certain editors, and all of those cost money, and while they had money to pay for my time, it was a political issue to buy a license for an editor, so could you just use Notepad or emacs please because you can't download any of those free OSS editors because the Y2K people haven;'t approved them and even though it's after Y2K, see the policy is in place and we can't go around policy. and sure, you're working on code but since you're a consultant the secretaries get first dibs on new machine so you'll have to use this out-of-date machine because otherwise the employees would feel put out, ok?
emacs is great if you want to use emacs. If you don't, it's yet another thing to acclimate to.
posted by orthogonality at 12:59 PM on March 17, 2005
yerfatma writes "MySQL isn't a real database until it includes views and stored procedures.
"Well, it does include stored procs now. And I'm fairly certain that kind of opinion should be reserved for impressing the ladies, not for derailing a question about learning SQL. Everyone needs to walk before they run, so views and stored procs aren't all that important here. MS-SQL is fine too. It's a place for sticking data. A text file is fine if you're starting to program."
Well, I'm not above impressing the ladies. But my answer was in no way a derail: whatever the merits of MySQL, MySQL does not adhere to the ANSI SQL Standard. So learning MySQL isn't the same as learning SQL: it's like learning Dutch and calling that German -- sure they're similar, but they're not the same.
And because MYSQL doesn't include some essential features of SQL -- especially views, but also correlated sub-queries, triggers, constraints -- someone who thinks that MySQL represents all of SQL is going to make bad decisions when faced with real SQL databases. For example, needs that in a full-featured SQL you'd obviously implement as views, the MySQL person would implement in the client-side program -- because MySQL doesn't have views. What would be the only right answer in MySQL would be a bad bad answer in any non-MySQL RDBMS.
When you learn, you want to learn the most general "dialect" around, not a pidgin that is spoken only in certain environments.
Knowing ANSI SQL, I can do MySQL and I can probably do it pretty well and efficiently -- all I need do is remember what features are not available. The same can't be said for someone whose baseline knowledge is only of MySQL's peculiarities.
posted by orthogonality at 1:09 PM on March 17, 2005
"Well, it does include stored procs now. And I'm fairly certain that kind of opinion should be reserved for impressing the ladies, not for derailing a question about learning SQL. Everyone needs to walk before they run, so views and stored procs aren't all that important here. MS-SQL is fine too. It's a place for sticking data. A text file is fine if you're starting to program."
Well, I'm not above impressing the ladies. But my answer was in no way a derail: whatever the merits of MySQL, MySQL does not adhere to the ANSI SQL Standard. So learning MySQL isn't the same as learning SQL: it's like learning Dutch and calling that German -- sure they're similar, but they're not the same.
And because MYSQL doesn't include some essential features of SQL -- especially views, but also correlated sub-queries, triggers, constraints -- someone who thinks that MySQL represents all of SQL is going to make bad decisions when faced with real SQL databases. For example, needs that in a full-featured SQL you'd obviously implement as views, the MySQL person would implement in the client-side program -- because MySQL doesn't have views. What would be the only right answer in MySQL would be a bad bad answer in any non-MySQL RDBMS.
When you learn, you want to learn the most general "dialect" around, not a pidgin that is spoken only in certain environments.
Knowing ANSI SQL, I can do MySQL and I can probably do it pretty well and efficiently -- all I need do is remember what features are not available. The same can't be said for someone whose baseline knowledge is only of MySQL's peculiarities.
posted by orthogonality at 1:09 PM on March 17, 2005
MySQL isn't a real database until it includes views and stored procedures.
Well, it does include stored procs now.
Sorry to keep the stupid derail going, but for clarity's sake: MySQL5 supports both views and stored procedures.
posted by nakedcodemonkey at 1:10 PM on March 17, 2005
Well, it does include stored procs now.
Sorry to keep the stupid derail going, but for clarity's sake: MySQL5 supports both views and stored procedures.
posted by nakedcodemonkey at 1:10 PM on March 17, 2005
orthogonality: Who the hell ever said in this thread that mySQL represents all of SQL?
And what of the guy who learns Transact SQL under MS-SQL and then is shocked and awed when he finds Oracle does not support it? I guess that qualifies MS-SQL Server as not a real database, either?
posted by xmutex at 1:13 PM on March 17, 2005
And what of the guy who learns Transact SQL under MS-SQL and then is shocked and awed when he finds Oracle does not support it? I guess that qualifies MS-SQL Server as not a real database, either?
posted by xmutex at 1:13 PM on March 17, 2005
you'll find Cygwin indefensible for coding
"Inconceivable!"
posted by Tubes at 1:19 PM on March 17, 2005
"Inconceivable!"
posted by Tubes at 1:19 PM on March 17, 2005
As others have said, managing your database using SQL data definition language (DDL) is a much better approach than using a GUI, but I wouldn't knock the GUI altogether. The ones I've worked with provide a feature to write SQL for table definitions, which I found useful when I was learning. Database purists may flame me for this, but rather than wrestle with sometimes cryptic documentation, I'd create a table or two in the GUI, save the table definitions as SQL, and use that as a model to write SQL for other tables I needed. If you go the MySQL or PostgreSQL route, the free version of DBTools DBManager has a nice GUI that will generate database scripts.
posted by hoppytoad at 2:27 PM on March 17, 2005
posted by hoppytoad at 2:27 PM on March 17, 2005
I personally would go for Postgres over MySql. If you learn in a feature-rich environment, then you can cope in a feature-poor one later. I think it's harder to come into a feature-rich environment and not realise what's available.
Also MySQL sucks.
*ahem*
I think you should stop thinking about learning SQL and start thinking about learning about relational databases. There are lots of conceptual things you should be getting your head around, like transactions, relations, normalisation and so on. SQL's a language for talking to the database, but if you don't understand what the database can do, you won't know what to say.
And that's why I would go for Postgres, which has a reasonably mature implementation of damn near everything you would want in an RDBMS (Relational Database Management System). I know MySQL is catching up fast, that it's common as muck, and that it's ideal where speedy SELECTs are the biggest requirement. But I think you'll learn more bad habits with it than with Postgres.
On the Java front, you can do a lot with just the Java SDK, but you might be better served by getting your hands on Eclipse, which is a free and very good Java IDE. Actually, what sebas said.
In terms of what you need on your computer, you also need JDBC drivers to connect Java and your database. You'll be downloading them and installing them with your database.
You didn't ask, but Bruce Eckel's Thinking In Java is excellent and freely downloadable, and includes a good chapter on JDBC. Dunno what I would recommend for databases and SQL.
posted by i_am_joe's_spleen at 10:34 PM on March 17, 2005
Also MySQL sucks.
*ahem*
I think you should stop thinking about learning SQL and start thinking about learning about relational databases. There are lots of conceptual things you should be getting your head around, like transactions, relations, normalisation and so on. SQL's a language for talking to the database, but if you don't understand what the database can do, you won't know what to say.
And that's why I would go for Postgres, which has a reasonably mature implementation of damn near everything you would want in an RDBMS (Relational Database Management System). I know MySQL is catching up fast, that it's common as muck, and that it's ideal where speedy SELECTs are the biggest requirement. But I think you'll learn more bad habits with it than with Postgres.
On the Java front, you can do a lot with just the Java SDK, but you might be better served by getting your hands on Eclipse, which is a free and very good Java IDE. Actually, what sebas said.
In terms of what you need on your computer, you also need JDBC drivers to connect Java and your database. You'll be downloading them and installing them with your database.
You didn't ask, but Bruce Eckel's Thinking In Java is excellent and freely downloadable, and includes a good chapter on JDBC. Dunno what I would recommend for databases and SQL.
posted by i_am_joe's_spleen at 10:34 PM on March 17, 2005
This thread is closed to new comments.
I'm not sure, but I'd wager money that Java has mySQL libraries available.
posted by xmutex at 9:39 AM on March 17, 2005