Cookbook/InterfacingWithScala

From Kx Wiki
Jump to: navigation, search

The wiki is moving to a new format and this page is no longer maintained. You can find the new page at code.kx.com/q/interfaces/scala-client-for-q/.

The wiki will remain in place until the migration is complete. If you prefer the wiki to the new format, please tell the Librarian why.

Compile http://kx.com/q/c/kx/c.java

e.g.

mkdir kx
curl -L -k http://kx.com/q/c/kx/c.java > kx/c.java
javac kx/c.java

Create a file a.scala containing

object KxTest {
 def main(args: Array[String])
 {
      val conn=new kx.c("localhost",5001)
      println(conn k("2+2"))
      conn close
 }
}
KxTest.main(null)

start a kdb+ process listening on port 5001, e.g.

q -p 5001

and execute the above program using

scala -cp . a.scala

and it should print 4

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox