I've recently started my first programming job, and what I need to do as my main project is to create a program for simulating diesel generator behaviour.
I'm creating this program using Java, which I've never used before (all of my limited experience is with C++), and the first problem I need to overcome is to create a database to store the necessary data that will act as input to the simulator.
This database problem strikes me as something that has, in general, been done many times before. Could anyone get me started on the right track towards achieving this with suggestions on what to use to first create the database, and then what to use to access it with the simulator? In regards to the latter, I've been reading over the java.sql package, and it seems as though it would suit my purposes. What do you think?
Thanks very much in advance.
Database access in Java goes via JDBC. (Indeed all those classes are in the java.sql package)
Check the JDBC Tutorial
Here is a sample snippet from that tutorial to give you an impression:
Connection con = DriverManager.getConnection
( "jdbc:myDriver:wombat", "myLogin","myPassword");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM Table1");
while (rs.next()) {
int x = rs.getInt("a");
String s = rs.getString("b");
float f = rs.getFloat("c");
}
JDBC is compatible with any Relational Database Management System. I like MySQL myself, as it is free and has plenty of documentation on the web. But any RDBMS goes.
If you're going for MySQL, a simple way to get started is to install MySQL and create the database directly from the MySQL shell. PhpMyAdmin is another simple option to manage a MySQL database. (On windows, in combination with XAMPP. On linux, from your distro's package manager)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With