Not sure about inserting databases into java

I want to know how you can insert a database in to java

Page 1 of 1

3 Replies - 698 Views - Last Post: 23 April 2008 - 07:34 AM Rate Topic: -----

#1 candleguy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-February 08

Not sure about inserting databases into java

Posted 21 April 2008 - 02:21 AM

[]import javax.swing.JOptionPane;[]


[]public class GUI[]
{
[] public static void main (String args[])[]
{

[]JOptionPane.showMessageDialog(null,"Good day user \n Welcome to Numbers \n i'm Peter and i really hope that you will enjoy working on my program \n This is a introductory program for me abd i hope you'll be amazed by or if theres any problems just let me know by dialing this number 0732165179 ","INTRODUCTION",JOptionPane.INFORMATION_MESSAGE);[]

[] String nam = JOptionPane.showInputDialog(null,"User could you please type in your name ?(Press ENTER)", "NAME",JOptionPane.QUESTION_MESSAGE);[]

[] String an =JOptionPane.showInputDialog(null,"Thank you "+nam+" for providing your name. \nwe'll keep it a secret and promise that no one will know who you are.\n "+nam+" we were wondering if you would mind answering the next questions\n Press 1 for yes or 2 for no ", "Introduction",JOptionPane.QUESTION_MESSAGE);[]
[] int ans = Integer.parseInt(an);[]



[] if(ans <= 1)[]
{



[] String num2s = JOptionPane.showInputDialog(null,"Type in a integer thats >10","Numbers",JOptionPane.QUESTION_MESSAGE); []
[]int num1 = Integer.parseInt(num2s);[]

[] if(num1<10)[]
{
[] JOptionPane.showMessageDialog(null,"Sorry your integer you typed in is too small\n The program will now exit","EXIT",JOptionPane.WARNING_MESSAGE);[]

}
[] else[]
{


[]int numb = (int)(Math.random()*20+1);[]
[]int numb2 = (int)(Math.random()*20+1);[]
[]int numb3 = (int)(Math.random()*20+1);[]
[]int numb4 = (int)(Math.random()*20+1);[]


[] do[]
{
[]if((num1>11))[]
{


[]String number= JOptionPane.showInputDialog(null,nam+" Congratulations , lets try another one\nPress 1 to enter the maths game","CONGRATULATIONS",JOptionPane.QUESTION_MESSAGE);[]
[]int nams =Integer.parseInt(number);[]






[]if((nams==1))[]
{
[] boolean flag = false;[]
[]while(!flag)[]
{
[] number= JOptionPane.showInputDialog(null,nam+" Lets try something new \n We going to do multiplication \nWhats "+numb+"*"+numb2);[]
[]for (int i = 0; i<number.length();i++)[]
{
[]char ch = number.charAt(i);[]
[]if (Character.isDigit(ch))[]
{
[]flag = true;[]
}
}
}
[]int nams1 =Integer.parseInt(number);[]

}



}
[]else[]
{

[] JOptionPane.showMessageDialog(null,"You Out","EXIT",JOptionPane.ERROR_MESSAGE);
System.exit(0);[]


}


[] String number= JOptionPane.showInputDialog(null,nam+" Lets try something new \n We going to do multiplication \nWhats "+numb+"*"+numb2);[]
[]int nams =Integer.parseInt(number);[]
[]int numbss =numb*numb2;[]
[] while(nams!=numbss)[]
{

[]String number11= JOptionPane.showInputDialog(null,nam+" Lets try something new \n We going to do multiplication \nWhats "+numb+"*"+numb2);
int nams12 =Integer.parseInt(number11);[]
}

[] int numbsss = numb3*numb4;[]
[]String number1= JOptionPane.showInputDialog(null,nam+" Whats "+numb3+"*"+numb4);[]
[]int nams1 =Integer.parseInt(number1);[]

[]if((nams1==numbsss))[]
{

[] JOptionPane.showMessageDialog(null,"Congratulations, you are clever hey!","CONGRATULATIONS",JOptionPane.INFORMATION_MESSAGE);[]

JOptionPane.showMessageDialog(null,"Thank you for playing the game number with us and i hope you had enjoyed it ","EXIT",JOptionPane.INFORMATION_MESSAGE);[]

[] System.exit(0);[]


}



[]else[]
{

[] JOptionPane.showMessageDialog(null,"WRONG ANSWER","ERROR",JOptionPane.ERROR_MESSAGE);[]


}
}
[]while(num1>11);[]













}


}
[]else[]
{
[] JOptionPane.showMessageDialog(null,"Okay , Thak you for using the program \n The program will now exit","EXIT",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);[]
}

}
}

Is This A Good Question/Topic? 0
  • +

Replies To: Not sure about inserting databases into java

#2 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Not sure about inserting databases into java

Posted 21 April 2008 - 02:37 AM

So what is the question?
Was This Post Helpful? 0
  • +
  • -

#3 candleguy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-February 08

Re: Not sure about inserting databases into java

Posted 23 April 2008 - 07:06 AM

View Post1lacca, on 21 Apr, 2008 - 02:37 AM, said:

So what is the question?

Can you please help because i want to insert a database into a mathematical program and when the user got a answer right music in mp3 format must play ... please help :D
Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Not sure about inserting databases into java

Posted 23 April 2008 - 07:34 AM

If you are asking about accessing databases from Java, that is a quite big topic, and there is no short answer / example for it. I can recommend the JDBC tutorial from Sun to start with.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1