Configurar Poll de conexão. SQLServer2005 + GlassFish [Resolvido]

Salve moçada .

Estava usando aqui uma conxexão com SQL server 2000 assim :


URL: jdbc:microsoft:Sqlserver://IP_AQUI:1535;DatabaseName=Ficsa;ProgramName=Ficsa;SelectMethod=Cursor
User: *****
Senha: *****

//-------------------------------------------

public Connection getConnection() throws DaoException {
		try {
			Context context = new InitialContext();			
			DataSource dataSource = (DataSource) context.lookup("jdbc/ficsa");


//---------------------------

Driver Classname: com.microsoft.jdbc.sqlserver.SQLServerDriver

E funcionava certinho .

Agora mudaram a base aqui para SQLServer 2005. Ele até chega a conectar com a base. Mas na hora de executar uma query:


GRAVE: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x38 is unknown.

Se eu mudar o driver para :


com.microsoft.sqlserver.jdbc.SQLServerDriver

Aí ele nem pinga :S

Algém tem alguma sugestão ?

Devo mudar algo na URL quando troco o driver ?

Obrigado !

Talvez isso te ajude: http://www.guj.com.br/java/79443-como-instalar-o-jdbc-driver-para-sql-server-2005

Obrigado por responder jaboot .

Porém o que solucionou meu problema foi um post Gringo aí :
Creditos para/Credits to : Edmon Begoli .
O link é esse :

Mas como tive muitos problemas com link quebrado, tô copiando e colando o tutorial do cara aqui embaixo:


Assuming that you have SQL Server Express and Glassfish installed:

To enable SQL Express for listening for external connections follow these excellent instructions

If you are interested in more details about configuring SQL Express to listen to external connections or if you have any troubles refer to these official instructions.

Download JDBC driver for SQL Server from Microsoft’s JDBC driver download site.
(Alternatively, you could use open source JTDS driver)

Copy the sqljdbc.jar (Microsoft’s SQL Server JDBC driver ver 2) file to /domains/domain1/lib/ext

Note: “domain1” is a default Glassfish domain. You may be using a different domain for your deployment.

Open administrative console for your Glassfish server: http://localhost:10375
(or use whichever value you use instead of localhost)

Default username is admin and default password is adminadmin.

From the main tree (“Common Tasks”) expand “Resources” and go to “JDBC”, “Connection Pools”.

Click “New”

Choose the name for your pool, and for the type select the javax.sql.ConnectionPoolDataSource, for the vendor select Microsoft SQL Server.

Click next.

One the next page, for “Datasource Classname” specify com.microsoft.sqlserver.jdbc.SQLServerXADataSource.

Leave all the “Pool Settings”, “Connection Validation” and “Transaction” parameters as they are for now. Scroll down to the bottom of the page and enter the “Additional Properties” configuration properties specific for your SQL server configuration.

Follow these instructions to specify these connection pool configuration properties specific to SQL Server.

When done click “Finish”.

Go back to your newly created Connection Pool and click ‘Ping’ button to verify connectivity.

Now, to access connection in a standard JNDI lookup fashion from your Java EE code you will need to configure JDBC resource.

From the JDBC tree (under Common Tasks -> Resources->JDBC) select “JDBC Resources”.

Click “New”

Type in a JNDI Name. Make it start with “jdbc/”.

From the “Pool Name” drop down box select the name of the pool you just created.

Optionally provide the description.

Keep the Status “Enabled” checked.

You should now be ready to connect to SQL Server from your Java EE code.