on 08-31-2007 11:15 AM
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
You need to add these jar files in the server using visual admin. This will add the driver at the server at the appropriate location. Did you do this?
Also the jar files for SQL Server 2000 and SQL Server 2005 is different. For 200 it is 3 jar files for 2005 it is only one jar file. This is FYI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved it by writing the following code
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();
stmt = con.createStatement();
String query = "SELECT * FROM SubjectBIR where Subject_ID='" + user + "'";
ResultSet result = stmt.executeQuery(query);
stmt.close();
con.close();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.