on 08-30-2007 12:33 PM
Dear All,
I am facing the issue of establishing connection with SQL Server from Java project developed in NWDS. I am writing a jaas plug-in, as a part of that I am writing a login module to authenticate a web application through jaas, and I got need of fetching some data from SQL Server which is located in remote host. I am getting error in the line of code
<b>Class.forName(com.microsoft.jdbc.sqlserver.SQLServerDriver)</b>
I also added the 3 jar files (msbase.jar,mssqlserver.jar,and msutil.jar) to my login module project and copied the same files at C:\usr\sap\J2E\JC01\j2ee\cluster\server0\bin\ext\MSSQL.
My MI Landscape is j2ee stack + abap stack +WAS 6.40 with MAXDb as a database.
Could anyone please let me know the solution if you are aware of it.
Thanks and Regards,
Kishore.
I solved this issue by using the following code snippet.
Connection con;
Statement stmt;
DataSource ds;
Context ctx;
ctx = new InitialContext();
if(ctx == null) throw new Exception("Boom - No Context");
ds = (DataSource)ctx.lookup("jdbc/SQLDB");
con = ds.getConnection();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi kishore,
i assume that you have your enclosing quotations...
and what error/exception is being thrown?
if it is class not found, better check your classpath.
regards
jo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.