JDBC - Connect and read data from database

From PU/ Programming in Java

Asked on 28 Jan, 2021

Like 0 Dislike 293 Views

Write a simple java program to connect database and read data in the table name"Student"which hava four fields name"id","name","address","DOB",and "Class". Assuming the"id" field as simple number, display the data of the students with id less than 100

Add a comment

13 Answers

Anonymous on 1 Dec, 2021 Like 0 Dislike

Hey, I visited your site and I think that your content is amazing! It is really engaging and original, you must have worked so hard to generate such a quality content. We are ForeMedia and we help website owners with great websites to maximize the revenue they make from their website. I would love to buy Ad Spaces on your website and pay you per each impression of the ads on your site. We are Google Ad Exchange Premium partners and we work with more than 100 Ad Network & thousands of premium direct advertisers who would LOVE to buy Ads directly from your site and we can guarantee to increase your revenue by at least 45% compared to other advertising solutions you are currently using. You deserve to earn more for your content and maximize your earning potential and I will help you unlock that potential! There is no cost, you can register to our monetization platform for free on this link: https://foremedia.net/start I will be available for you on the Live Chat if you need any help, or you can email me back to: jenny@foremedia.net if you have any questions. I have at least 17 Premium Advertisers that have asked me to approach you because they would like to advertise on your website on Premium eCPM [cost per impressions] basis. Have a good day & feel free to ping me for any question! Click the link here for 1 minute registration to our platform [it's free!]: https://go.foremedia.net/u/start/

Add a comment

Anonymous on 19 Nov, 2021 Like 0 Dislike

Dropified® automates dozens of the daily tasks required to run a successful dropshipping business, allowing you to focus on marketing and growing your eCommerce stores. Customer places order on your Dropified powered store and pays your retail proce. Dropified forwards the order to supplier and pays wholesale funds and your spplier ships the orders. You keep the profits!

All the big brands like Shopify BigCommerce, WooCommerce trust dropified It's free to setup and publish and then comfortable pricing as you scale. Sign up today and raise your margins - https://bit.ly/3HBko4A

Add a comment

Anonymous on 18 Nov, 2021 Like 0 Dislike

Hey,

Where you are an Entrepreneur or Online marketer or Marketing manager or an Enterprise, benefit from a wide variety of Free Forever tools. Take your business 100% in simple steps and send emails, create pages, and automate your marketing.

The plans start from $0 to custom plans that suit your business and needs. You Start for free and you can cancel anytime. No credit card required.

GetResponse empowers businesses to do what they do, better, because solutions are made for customers whose needs are as diverse and multifaceted as we are. Join the platform and scale your business to new heights. Signup here - https://bit.ly/2YX9swz

Add a comment

Anonymous on 18 Nov, 2021 Like 0 Dislike

Hey,

I use google daily. I recently started to make my searches earn me money. Free money and in cryptocurrency. You will never find a more safer, easier and passive way to earn cryptocurrency.

Join me in the journey to make even a single search pay you free money. It's easy, free and completely safe with no fear of losing any money.

Join https://presearch.org/signup?rid=3094804 and earn money everyday without any effort and more when your referrals join and then their referrals join.

Cheers!

Add a comment

Anonymous on 17 Nov, 2021 Like 0 Dislike

Accept payments from customers at the lowest charges and get your payments settled instantly. Instant activation in 2 minutes. Zero setup fee and no annual maintenance fee. Pay as you use.

Automate payouts to vendors & employees. Never run out of working capital. Get free access to world-class suite of applications to manage and monitor your finances.

Offer your customers the luxury of all payment modes including Credit/Debit cards, Netbanking, Wallets etc.

Join the 50,00,000+ businesses using Razorpay - https://bit.ly/3kHv4of

Add a comment

Anonymous on 15 Nov, 2021 Like 0 Dislike

Hey,

Earn $30 per month by investing 10 secs daily. Signup for hi .com using my link and earn daily $1 by answer a question. You get $1 when you signup and 50% of the earing made by your referrals. Signup here - https://bit.ly/3wJW3o1

Cheers, Aish

Add a comment

Anonymous on 14 Nov, 2021 Like 0 Dislike

Hey, I visited your site and I think that your content is amazing! It is really engaging and original, you must have worked so hard to generate such a quality content. We are ForeMedia and we help website owners with great websites to maximize the revenue they make from their website. I would love to buy Ad Spaces on your website and pay you per each impression of the ads on your site. We are Google Ad Exchange Premium partners and we work with more than 100 Ad Network & thousands of premium direct advertisers who would LOVE to buy Ads directly from your site and we can guarantee to increase your revenue by at least 45% compared to other advertising solutions you are currently using. You deserve to earn more for your content and maximize your earning potential and I will help you unlock that potential! There is no cost, you can register to our monetization platform for free on this link: https://foremedia.net/start I will be available for you on the Live Chat if you need any help, or you can email me back to: jenny@foremedia.net if you have any questions. I have at least 17 Premium Advertisers that have asked me to approach you because they would like to advertise on your website on Premium eCPM [cost per impressions] basis. Have a good day & feel free to ping me for any question! Click the link here for 1 minute registration to our platform [it's free!]: https://go.foremedia.net/u/start/

Add a comment

Anonymous on 14 Nov, 2021 Like 0 Dislike

Hey,

I am Aish K. I am sure you have heard about all the crazy surrounding cryptocurrency. Also about the dangers and volatility too. People have lost millions in crypto and also earned billions. Here is your chance to start your journey free and 100% safe without any fear of losing.

Join https://hi.com/ashkaps and earn $1 everyday free and more when your referrals join and then their referrals join.

Cheers, Aish

Add a comment

Anonymous on 14 Nov, 2021 Like 0 Dislike

Hey,

Earn upto assured $22.5 monthly when you use Presearch to do your browser searches. It's same as your favourite browser search engine and earns your free money without any extra effort. Moreover earn everytime one of your referrals join Presearch. It's simply great. Join here - https://bit.ly/3ouIGEr

Cheers, Aish

Add a comment

Anonymous on 13 Nov, 2021 Like 0 Dislike

Hey,

I am Aish K. I am sure you have heard about all the crazy surrounding cryptocurrency. Also about the dangers and volatility too. People have lost millions in crypto and also earned billions. Here is your chance to start your journey free and 100% safe without any fear of losing.

Join https://hi.com/ashkaps and earn $1 everyday free and more when your referrals join and then their referrals join.

Cheers, Aish

Add a comment

Anonymous on 13 Nov, 2021 Like 0 Dislike

Hey,

I am Aish K. I am sure you have heard about all the crazy surrounding cryptocurrency. Also about the dangers and volatility too. People have lost millions in crypto and also earned billions. Here is your chance to start your journey free and 100% safe without any fear of losing.

Join https://hi.com/ashkaps and earn $1 everyday free and more when your referrals join and then their referrals join.

Cheers, Aish

Add a comment

Anonymous on 24 Oct, 2021 Like 0 Dislike

Hey, The biggest monetizing mistake made by 59% bloggers and website owners is that they ignore the importance of having a monetizing plan. However, you can have a flawless monetizing plan for sure but to implement your strategy, you have to have a team of monetizing experts. Do you know 73% of successful small and medium size blogs and websites generating six figure income, partner with third party monetizing experts like Foremedia. It’s pretty simple! You put all your energy into adding valuable content on your website to engage your audience and Foremedia with the help of our Premium ADX License will transform your traffic into money. CTA:- Stop thinking, register yourself and start monetizing your website traffic from today https://bit.ly/foremedia-join Cheers

Add a comment

Anonymous on 2 Feb, 2021 Like 0 Dislike

import java.sql.* ;

public class ReadAndConnect{

public static void main(String[] args){

Statement statement ;

Connection connection ;

ResultSet resultset ;

try(

 connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/students", "username", "password") ;

statement = connection.createStatement() ;

resultset = statement.executeQuery("select id, name, address, dob, class from students where id < 100") ; 

){

int i = 0 ;

while(resultset.next()){

for(i = 0 ; i < 5; i++) System.out.printf("\t%s", resultset.getObject(i)) ;

System.out.println("") ;

}

}catch(Exception e){e.printStackTrace(); }

}

Add a comment


Add your answer