Java in schools?

general_koffi

Expert Member
Joined
Jun 19, 2005
Messages
1,627
I matriculated last year. We did Java with Ready to Program, Netbeans and JGrasp.

Dunno why there were so many. I mainly used Ready because it's basically Notepad with a "compile" button. (IoW, simple.)
 

greggpb

Expert Member
Joined
Apr 22, 2005
Messages
1,818
They'll never teach you memory management in a school module, when I was in school we did Pascal and at no point did they tell us anything about pointers and heap allocation/deallocation.

we did memory managment back in 97
 

sn3rd

Expert Member
Joined
Jan 18, 2008
Messages
4,305
Yeah, pretty much exactly what I mean. In the IDE you have to connect to a database before you view or manipulate the contents. Now if you wanted to create say a simple accounting program with GUI interface, how would you connect to the database from outside Netbeans like any normal program?

The mysql server (if so configured) allows a connection through telnet. If you mean you want to use Java to access the database, then you need the jdbc and something like mysql connector. Don't know if I'm understanding your question correctly though
 

Gnome

Executive Member
Joined
Sep 19, 2005
Messages
7,210
we did memory managment back in 97

Perhaps your school did but it's never been part of the curriculum (for public schools).

I think rather teach a student how the heap/stack works in Java and once their good with that let them handle the deallocation themselves VS. GC.

Not really much of a difference anyway, the only thing that's different in Java is that you don't have to deallocate memory and the syntax has been obfuscated (in a matter of speaking).

my 2c.
 

AirWolf

Honorary Master
Joined
Aug 18, 2006
Messages
24,404
The mysql server (if so configured) allows a connection through telnet. If you mean you want to use Java to access the database, then you need the jdbc and something like mysql connector. Don't know if I'm understanding your question correctly though

Maybe I'm using the wrong terminology:eek:.

I was thinking more of something like a matric programming project (in Turbo Pascal) --> the program has the create, read, edit, delete, sort funtionality and compiled to .exe you can run it independently of Turbo Pascal.

So what would be the Java equivalent of this? :confused: I have seen a little about the GUI app builder with CRUD functionality, but in the IDE you have to connect to a database to run your app.
 

TheRiddl3r

Active Member
Joined
May 22, 2007
Messages
50
Matriculating this year, we used Ready to Program from Gr 8 - Gr 10, then switched to jGrasp and have been using that ever since.

How do you connect to a DB from outside the IDE?

Here's the code that we were taught to connect - NOTE: doesn't work with 2007

import java.sql.*;

private Connection conn = null;

public static void makeConnection()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection(
"jdbc:eek:dbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=DBNAME.mdb ");
//file's name is "DBNAME.mdb" and is in the same directory as the
//.java & .class file -- this will change to point to the right file
//an absolute or relative path is possible, but the method shown is
//probably best for exam conditions where files 'move'

System.out.println("Connection successful");
}
catch(Exception e)
{
System.out.println("Failed to get connection");
e.printStackTrace();
}
}

Then to do stuff we used SQL like the following:

try
{
Statement stmt = conn.createStatement();
//SQL to query the database
ResultSet rs = stmt.executeQuery("SELECT * FROM tblCD");
while(rs.next())
{
String Artist = rs.getString("Artist");
String Title = rs.getString("Title");

//etc. etc. etc. for the remaining fields
//print to screen -->> not very pretty, we just want to see it work!

System.out.println("Artist: " + Artist + "\nTitle: "+Title);


}
rs.close();
}
catch(SQLException e)
{
e.printStackTrace();
}


Probably not nicely spaced on the forum, but there it is.
 
Last edited:

sn3rd

Expert Member
Joined
Jan 18, 2008
Messages
4,305
Maybe I'm using the wrong terminology:eek:.

I was thinking more of something like a matric programming project (in Turbo Pascal) --> the program has the create, read, edit, delete, sort funtionality and compiled to .exe you can run it independently of Turbo Pascal.

So what would be the Java equivalent of this? :confused: I have seen a little about the GUI app builder with CRUD functionality, but in the IDE you have to connect to a database to run your app.

The Java equivalent of compiling your program to .exe so you can easily distribute it is to use something like gcj to compile your files. This outputs an executable. But this kind of defeats one of the main purposes of Java: Platform independence achieved by compiling to bytecode for interpretation by the runtime environment. Compiling to .exe would effectively eliminate that capability. But it is useful for deployment of you Java apps.

Did I answer your question THIS time? :confused:
 

Gnome

Executive Member
Joined
Sep 19, 2005
Messages
7,210
There is no OFFICIAL tool that compiles Java to binary and all of them have problems so be careful when using them.

Sun Microsystems doesn't work on such compilers since it's against the "Write once run everywhere" motto.
 

sn3rd

Expert Member
Joined
Jan 18, 2008
Messages
4,305
There is no OFFICIAL tool that compiles Java to binary and all of them have problems so be careful when using them.

Sun Microsystems doesn't work on such compilers since it's against the "Write once run everywhere" motto.

You again!!! :eek:
 

AirWolf

Honorary Master
Joined
Aug 18, 2006
Messages
24,404
The Java equivalent of compiling your program to .exe so you can easily distribute it is to use something like gcj to compile your files. This outputs an executable. But this kind of defeats one of the main purposes of Java: Platform independence achieved by compiling to bytecode for interpretation by the runtime environment. Compiling to .exe would effectively eliminate that capability. But it is useful for deployment of you Java apps.

Did I answer your question THIS time? :confused:

Yep, thanks:).

I'm new to java so pardon my ignorance:eek:.
 

sn3rd

Expert Member
Joined
Jan 18, 2008
Messages
4,305
Not at all...

Oh, and be sure to note Gnome's comment about gcj
 
Top