Code is always the same because Java take care of backward compatibility.
Here you have tutorial about connection to database.
They explain every line of code what is made for.
Read that and I think you will not have any problems in future.
Kind regards, Mike.
my advice: learn to write your persistency code in such a way that it's not db dependent. it's much easier to work if on changing a db, all you need to do is change one single property, and not your actual code.
^ like he said.
For learning, unles you are already a MySQL admin fiend, I can recommend using the JavaDB that came with your JDK, and NetBeans which has support for JavaDB burned in to its "services" tab. Setting up a database server isn't trivial unless you already know how how to do it. Using NetBeans/JavaDB will enable you to concentrate on your Java. Later you can change the connect statement to work with MySQL or whatever - the rest of the Java SQL support is database-independent.
Just saw milil's post -
Beware that tutorial if you want current info. It starts with classForName, which became obsolete in 2006 (if not earlier).
Telling you to use classForName is a dead give-away for a tutorial that's not been updated for years and years.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.