Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why this error is giving  RSS feed

 
pardha saradhi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have binded the datasource to JNDI and I wrote
a stateless session bean accessing database.
I got folloing error on server side.
I am printing the data source also.
Server side console messages..................
Binding DataSource, name = jdbc/EmpDb, url = jdbc:microsoft:sqlserver://199.199.199.2:1433;user=saradhi;password=saradhi;DatabaseName=nags
*******************************************************
Data Source :com.sun.enterprise.resource.JdbcDataSource@6d1dbe
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver][SQLServer]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSLoginRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(../../src/share/com/sun/enterprise/resource/JdbcUrlAllocator.java:49)
at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(../../src/share/com/sun/enterprise/resource/PoolManagerImpl.java:181)
*************************************
1. Can I assume that datasource has been binded with JNDI properly?
2. What might be the problem?
Thanking you in advance
Saradhi
 
Ram Dhan Yadav K
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saradhi,
Seems that you made a JNDI configuration, but i am not sure whats happenning. You can do one thing try uisng JDBC-ODBC bridge and DSN stuff first and check it. I remember doing this on JRun server for SQLServer and was successful. I will let you know if i can find more information about your exception.
good luck,
 
pardha saradhi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ram
Thank you.
do you have info. about how to configure JNDI?
if so please let me know .
Even with DSN how to do....
Thanking you in advance
Saradhi
 
Ruilin Yang
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saradhi,
private String dbName = "java:comp/env/jdbc/customerDB";
InitialContext initial = new InitialContext();
ds = (DataSource)initial.lookup(dbName);

java:comp/env/jdbc/ --- application server vendor specific
customerDB --- the name of the datasource registered in the app server, which points to a real database name (you database name, e.g. myFirstDB in SQLServer or Oracle).
You need to register your data source with you app server management console.
Good luck
Ruilin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!