DataSource Creation for MSSQLServer2005 using SJSAS8.2:

1)Open server admin console by giving username and password if exists.
2)There goto Application Server -> Resources -> JDBC-> Connection Pools -> select New->
  Name: mssqlpool
  Resource Type: javax.sql.DataSource
  Database Vendor: mssql
  Next-> Enter DataSource Class Name: com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource
 [u can find the this class name in the sqljdbc.jar, if u are using different database then goto corresponding jdbc driver jar file and find the class that ends with  ConnectionPoolDataSource]
  Next-> goto Properties section, enter the following details:
  Datasource name: sample_ds
  User name: sa
  Password: ********
  Database name: SampleAppDB
  Server name:  VENU-PC
  Click on Save.
3)Goto Jdbc Resources on left pane-> select New on right pane and create jndi name for the above connection pool. -> Save
  JNDI name :jdbc/mssql
  Connection pool: mssqlpool [scroll down it will show all the available connection pools]
4)Now add sqljdbc.jar to the SUN/Applicationserver/lib folder
5)If we select the Application Server tab on left pane , It displays different tabs on right pane.
  Goto JVM settings-> Path settings-> In Classpath Prefix textbox: Add the below information

  ${com.sun.aas.installRoot}/lib/sqljdbc.jar [ this is like telling driver jar to the application server]
6)Stop the server if it is running and restart it. Now open admin console -> select mssqlpool under connection pools-> click on ping
7)If everything goes fine It diaplays the message like Ping succeeded.
8) Now we can get the connection like below from java:
InitialContext ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup(“java:comp/env/jdbc/mssql”);
Connection con=ds.getConnection();

About vchaithanya

Software Engineer
This entry was posted in Database. Bookmark the permalink.

Leave a comment