Skip to main content

Configuration of jdbc connection pool with mssql

6 replies [Last post]
rumex
Offline
Joined: 2011-06-25
Points: 0

Hi All..

I am a new programmer in JSF, and i just learn it within last week, and i am traing now to work with it..

I gotting problem with "jdbc connection pool", i try to create a pool to connect with MS SQL.

and I made a search and got a lots of link to explain how to connect with MSSQL.. and i got example on this link "http://download.oracle.com/docs/cd/E19879-01/820-4335/beana/index.html" but i try to get these "The JAR files for this driver are smbase.jar, smsqlserver.jar, and smutil.jar." file but i didnt find them!!

until i got other topic to help by conect with "jtds",

http://www.java.net/node/700203

and i followed it but i got other error, by clickinh PING.. i got:

"Ping Connection Pool for microsoft_jtds_pool is Failed. Ping failed Exception - Connection could not be allocated because: Network error IOException: Connection refused: connect Please check the server.log for more details."

Please i need an advice to solve this problem..

Thanks in Advance..

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rumex
Offline
Joined: 2011-06-25
Points: 0

I got the solve.. :)

I will mention how i connect Glassfish with Micrsoft SQL 2008 server.. to help any other programmer..

I am using "jtds-1.2.5" and you can download it from this link: http://jtds.sourceforge.net/

1) after you download the "jtds-1.2.5-dist.zip", unzip the file and you will find "jtds-1.2.5.jar", copy this file to lib folder on GlassFish folder, almost be on "c:". for example "C:\Program Files\glassfish\glassfish-3.1\glassfish\lib\".

2) then go to you GlassFish admin and create your JDB Connection Pool.

- Resources => JDBC => JDBC Connection Pools => New

Pool Name: any name

Next

DatabaseName: yourDBname
User: SQL Server login name, which usual be 'sa'
Password: ****
ServerName: localhost
PortNumber: 1433

Thats All.... but i got an error..

"Ping Connection Pool for microsoft_jtds_pool is Failed. Ping failed Exception - Connection could not be allocated because: Network error IOException: Connection refused: connect Please check the server.log for more details."

To solve it go to: Start => all programs => Microsoft SQL Server 2008 => Configuration Tools => SQL Server Configuration Manager.

then: SQL Server Network Configuration => Protocols for MSSQLSERVER => and then Enable TCP/IP protocal.

I hope it help any one get same error..

and thanks for whos gave me his time to solve this problem.

:)

sm157516
Offline
Joined: 2005-03-28
Points: 0

Have you set all the properties of the jdbc connection pool to the appropriate values? A sample jdbc connection pool configuration from the domain.xml for a mssql server 2005 looks like :

<jdbc-connection-pool
name="microsoft_sqlserver2005_pool"
datasource-classname="com.microsoft.sqlserver.jdbc.SQLServerDataSource"
res-type="javax.sql.DataSource">
<property name="user" value="DB_USER"/>
<property name="password" value="DB_PASSWORD"/>
<property name="serverName" value="DB_HOSTNAME"/>
<property name="portNumber" value="1433"/>
<property name="databaseName" value="DATABASE_NAME"/>
</jdbc-connection-pool>

Also make sure that the database is running in the host/port mentioned.

rumex
Offline
Joined: 2011-06-25
Points: 0

Thanks for your reply..

and i fill this all information.. and i am traying to conect with Microsoft SQL 2008..

User: sa

DatabaseName: ContactMG
Password: 1234567
ServerName: localhost
PortNumber: 1433
but still getting an error.. by this message "Ping Connection Pool for microsoft_jtds_pool is Failed. Ping failed Exception - Connection could not be allocated because: Network error IOException: Connection refused: connect Please check the server.log for more details."
sm157516
Offline
Joined: 2005-03-28
Points: 0

Check if you are able to connect to the same mssql database from a standalone program.

rumex
Offline
Joined: 2011-06-25
Points: 0

:)

Many thanks for your help.. i solve it by "Enable TCP/IP protocal"

(Start => All Programs => Microsoft SQL Server 2008 => Configuration Tools => SQL Server Network Configuration => Protocols for MSSQLSERVER => and then Enable TCP/IP protocal)

Thanks again for your times..

:)

rumex
Offline
Joined: 2011-06-25
Points: 0

Hi All..

Can please get a help to how to connect with Microsoft SQL server..

:)