I am having difficulty connecting my java code to sql server database. I can connect from App server just fine..but now I want to try to connect with app server out of the picture and using InitialContext
with some env properties. So a stand alone java class connecting to sql server using InitialContext
I have mssqlserver.jar in my projects libraries. Do I need some other jar as well?
I looked around for some code sample but dont know what to put in Context.INITIAL_CONTEXT_FACTORY
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "what do i put here?");
env.put("java.naming.factory.initial",
"what do i put here?");
...
what other properties would I need?
on the App server I have following properties.
datasourceName = mydb
user = myuser
port = 1433
password = mypwd
databaseName = mydb
servername = localhost