₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,000 members, 8,419,871 topics. Date: Thursday, 04 June 2026 at 05:29 AM

Toggle theme

How Do I Create A Java App That Works With A Relational Database? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHow Do I Create A Java App That Works With A Relational Database? (1292 Views)

1 Reply (Go Down)

How Do I Create A Java App That Works With A Relational Database? by eaglejay13(op): 6:03am On Feb 22, 2016
Please any help?
Re: How Do I Create A Java App That Works With A Relational Database? by larisoft: 8:45am On Feb 22, 2016
Ur question is not clear enough. But if u re writing a java web app, there is mysql and jbdc. If its desktop, look into h2 db.
Re: How Do I Create A Java App That Works With A Relational Database? by lekropasky(m): 1:36pm On Feb 22, 2016
Make you question Clearer. I might be able to help.
Re: How Do I Create A Java App That Works With A Relational Database? by DonSegmond(m): 2:37pm On Feb 22, 2016
You use a database driver to connect to the database.
Every database has a host, a name, a username and password.
Once you use that driver to connect, this is a psuedo example

dbConnection = dbConnect("host", "dbname", "dbuser", "dbpassword" ) ;

You will have your connection, then using that connection you can query the database.

queryResults = dbConnection.query("SELECT first_name, last_name FROM mytable" ) ;

rows = queryResults.fetchAll() ;

foreach (rows as r) {
print("Name " + r.first_name + " " + r.last_name + "\n" ) ;
}

then when you are done, you close the connection
dbConnnection.close() ;

This is how it works with pretty much every langauge, java, python, php, ruby, c

You must find what database driver you are going to use and study it very well.

Here is how to use Java and MySQL.
http://zetcode.com/db/mysqljava/

If you are using MSQL, PostgresSQL or Oracle, it will be a bit different, but not much.

Best of luck.
Re: How Do I Create A Java App That Works With A Relational Database? by eaglejay13(op): 4:26pm On Feb 22, 2016
Tnx all, you guys have helped me so much.
Re: How Do I Create A Java App That Works With A Relational Database? by eaglejay13(op): 4:33pm On Feb 22, 2016
Tnx a bunch @DonSegmond
Re: How Do I Create A Java App That Works With A Relational Database? by lekropasky(m): 7:51pm On Feb 22, 2016
If you plan to develop a Desktop application, i guess you should try and research about Databases that support Embedded Driver such as Java DB. For if you use Mysql your database can only be accessed through an internet server which i think might not be suitable for a standalone Desktop Application. So, it solely depends on the type of the application you want to develop. And if you need guideline to how you'll perform database manipulations, Google is your friend. If you are using Java, then search for ''Java JDBC tutorial''. This should get you On....

Happy Coding.
1 Reply

A Java App Developer Should Please HelpRelational Database Vs Nosql Database.Is It That MTN Developers Don't Understand Relational Operators?234

Affordable Nigerian Software Solution!!!!C: Why Do I Keep Gettng A 'segmentation Fault' Error On C4droid Android AppPlease Help And Advice