Creating user accounts for kdb+ personal edition

60 views
Skip to first unread message

Nav

unread,
Jan 18, 2009, 11:47:09 PM1/18/09
to Kdb+ Personal Developers
Hi,

I was exploring various means of connecting to a KDB+ database thru C
code. I came across two functions
1. khp, where we pass hostname and port
2. khpu, where we pass hostname, port, user id and password.


How can we create accounts in the kdb+ personal edition.

Please advice.

Nav

KDB+

unread,
Jan 19, 2009, 10:45:46 AM1/19/09
to personal...@googlegroups.com
create a file with user names and password in following manner-

user1:password1
user2:password2
user3:password3
user4:password4

run q session with this command -

q -u user_file_path -p prot_number

Simon Garland

unread,
Jan 19, 2009, 11:06:36 AM1/19/09
to personal...@googlegroups.com
or better, create a file with userids as below, but with the md5'd
passwords
and save the file one level up from the startup directory so it's not
directly accessible from the q session

// create the file

> simon@simon-macbook:~/q$ q
> KDB+ 2.5 2009.01.11 Copyright (C) 1993-2009 Kx Systems
>
> q)raze string md5"password1"
> "7c6a180b36896a0a8c02787eeafb0e4c"
> q)`:uu.txt 1:"user1:",(raze string md5"password1"),"\nuser2:",raze
> string md5"password2"
> `:uu.txt
> q)\\
> simon@simon-macbook:~/q$ cat uu.txt
> user1:7c6a180b36896a0a8c02787eeafb0e4c
> user2:6cb75f652a9b52798eb6cf2201057c73

// shift it upstairs

> simon@simon-macbook:~/q$ mv uu.txt ..

// and start a password protected session

> simon@simon-macbook:~/q$ q -u ../uu.txt -p 5005
> KDB+ 2.5 2009.01.11 Copyright (C) 1993-2009 Kx Systems
>
> q)


// then from another session try and login

> q)hopen`::5005
> 'access
> q)hopen`::5005:user1
> 'access
> q)hopen`::5005:user1:password
> 'access
> q)hopen`::5005:user1:password1
> 3
> q)3"read0`:../uu.txt"
> 'access
> q)

Nav

unread,
Jan 20, 2009, 4:22:51 AM1/20/09
to Kdb+ Personal Developers
Thanks for your help, but there seems to be a problem .

I have created user id and password combos and have stored them in the
file mentioned. I have added code in the c++ program, which allows the
kdb+ database to manipulate .csv files( to create the database). Now
when the code tries to use these csv files to create the database, an
error is thrown saying
"access"
which basically means that a protected database/file is accessed
without a valid userid and password, or the user doesnt have the
rights to access the said csv file.

How do I go about solving this issue. Please advice.

Nav.
> >> Nav- Hide quoted text -
>
> - Show quoted text -

Simon Garland

unread,
Jan 20, 2009, 5:00:51 AM1/20/09
to personal...@googlegroups.com
that's -u working as it should (you're presumably attempting to access
a file "above" the startup directory)

if you want the userid/password check, but don't want the access
control use -U instead

Nav

unread,
Jan 21, 2009, 2:11:11 AM1/21/09
to Kdb+ Personal Developers
Hi,

Thanks for your help. The issue got resolved with -U. However with -u,
even if the files were in the same directory as the q executable, the
same error was thrown.

Nav
> > How do I go about solving this issue. Please advice.- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages