-3

I would like to know how to access mongodb database from a scala swing application. I am new to scala.I have created a database named mydb in mongodb and a collection named studen(rollno,name,age,city). I simply want to perform insert, update and delete with swing on a mongodb database, but i have no idea which package to use and any other information that can be useful.

I am attching the swing code here.

Gui.scala

import swing._
import swing.event._
import swing.Component._

object Gui extends SimpleSwingApplication
{
def top = new MainFrame {
title = "Second Swing App"

val combobox = new ComboBox(List(("1"),("2"),("3"),("4"),("5"),("6"))){

}

val text1= new TextField(10){
}
val text2= new TextField(10){
}
val text3= new TextField(10){
}


val button = new Button {
text = "Clear"
}
val button1 = new Button {
text = "Save"
}
val button2 = new Button {
text = "Delete"
}

val button3 = new Button {
text = "Update"
}

val label = new Label {
text = "No button clicks registered"
}
contents = new BoxPanel(Orientation.Vertical) {
contents += combobox
contents += text1
contents += text2
contents += text3

contents += button
contents += label
contents += button1
contents += button2
contents += button3

border = Swing.EmptyBorder(30, 30, 10, 30)
}
 listenTo(button)

 reactions+={
 case ButtonClicked(button)=>


}  
}
haknick
  • 1,892
  • 1
  • 20
  • 28
survi
  • 152
  • 1
  • 5
  • 2
    If you take the time to format your question better you are more likely to get good answers. I'm not even going to bother reading the mess of code you just dumped on us. – Theo Nov 11 '10 at 06:26

1 Answers1

3

You can use the MongoDB Java driver in Scala, or you can use Casbah, a Scala wrapper around the Java driver.

Theo
  • 131,503
  • 21
  • 160
  • 205