The user that started jboss is in a standard java system property, so something like:
If you want to do something more complicated, then the same answer as I gave here:
Oracle version is 11g
Yes I've looked at this setup of oracle data source link but there is nothing about mapping os user to db user.
The problem is that I don't know how to force JBoss to connect to Oracle DB as an example osuser.
What I've done for now:
I created user named osuser as Windows user (my Machine name is OS)
I created account in db: OS\OSUSER identified externally.
I login to the system as this user and when I am using "sqlplus /" i can connect to db.
But I don't know how to configure data source in JBoss that would use this osuser to connect to DB.
I understand what you're talking about now. It's not really a JBoss question.
You need to read the docs to find out what url and/or properties you have to configure for your jdbc driver.
A simple google search "oracle.com os authentication jdbc" found this as the first link:
which is for Oracle's 11g1 thin driver.
However, the second link has a slightly different format for the url
but that's for 10g OCI and also hints at extra config for remote usage.
Anyway, in neither example is a user/password property specified.
So you probably need to remove the <user-name/> and <password/> xml elements from the jboss -ds.xml to get it to work?
i.e. you want them to be null, not the empty string.
Yes I saw this article (your 1 link) and I wrote simple java code to check this and it works fine.
(There is one strange thing - you don't need to be logged as the user you want to connect to DB, you can use e.g. -Duser.name=osuser when execute java code and this also works, so if you know username than you can connect to DB - it looks like security issue).
And yes I've tried to remove <user-name/> and <password/> from ...ds.xml in JBoss but this doesn't work.
I've also tried to add -Duser.name=... parameter to run.bat in JBoss bin but this doesn't change anything.
You tried your simple java code from the same machine as where jboss is running, with the same user?
Have you tried it from inside jboss, e.g. a simple jsp page?
The only thing I can suggest is to:
Enable TRACE logging for org.jboss.resource.adapter.jdbc
Then we can confirm what properties and url it is actually passing to Oracle.
You should see something in the LocalManagedConnectionFactory that looks like:
Using properties: 
Checking driver for url: jdbc:oracle:thin:@dbs1:1521:dbname
That is what it will pass to createConnection(url, properties).
NOTE: It will only print the url the first time it creates a connection.