JNDI – configuration database connection to SQL Server 2012 in GlassFish for JSTL

First You must downloading driver of SQL Server ( sqljdbc4.jar ). Copy it into lib directory in GlassFish instalation place. Mine it is:

C:\Program Files\glassfish-4.0\glassfish\lib

01Next run GlassFish server. I run it in Netbeans right clicking the GlassFish node in Servers and choose Run.

02If server is running, open browser with address:


The Administrative Console appear.

03Click the JDBC item on the left section in Resources node.
You see two links.

04Click the JDBC Connection Pools link.
It will be display list of Connection Pools. Click the New button.


You see New JDBC Connection Pool section.

06Write your own pool name. I mine name as SQLServer2012. from list of Resource Type select as javax.sql.DataSource.
From list of Database Driver Vendor choose MicrosoftSqlServer. Click the Next button.

07In second step You see these data:

0809You must filling field: URL, User, Password, DatabaseName, ServerName.

10My URL is jdbc:sqlserver://DORA-KOMPUTER\SQLEXPRESS:1433;

Click the Finish button.

11Go to the Resources section and click the JDBC Resources.

12You see list of JNDI Names.

13Click the New button. It displays configuration section.

14In JNDI Name field write jdbc/sql2012 or your own name. From Pool Name select your defined pool: SQLServer2012.
In Description field write for example: SQL Server 2012 or leave empty. Click the OK button.

15On the list you see new JDBC Resource.

16If you click in JDBC Resources node jdbc/_default, you may select Pool Name as SQLServer2012 and click Save button.

Test connection pool. Choose from JDBC Connection Pools item SQLServer2012 and click Ping button.

c1If it’s all right you see information about success:

c2Restart GlassFish server.