Showing posts with label jdbc. Show all posts
Showing posts with label jdbc. Show all posts

Tuesday, February 14, 2012

Connection SQL Server 2005 with DNS hostname mismatch

When using the MS SQL 2005 JDBC driver, I now need to have the DNS name
resolution to the client correctly set up. If not I get the following
error:

SQLState: 08S01
SQLError: 0
Message: hostname : hostname

Where "hostname" is the client host name. It doesn't seem to matter if
I
use an IP address or hostname in my connection URL. When searching the
net,
I have seen a similar error, but not exactly the same, where the
message is
"Hostname: hostname not found" (once again, here "hostname" is the
client
machine) where they suggested the issue was the DNS name conflict.

I found the error goes away if the client machine's hostname match the
DNS
name used for the same IP addess that the DB server is using. One
work-around is to set hostname on the client to the IP address being
used.

I know the right thing to do is set the hostname and the DNS name
lookup the
same, but I have a customer who doesn't want to do this. They didn't
have to
for 2003, and they don't want to for 2005. Sigh. Is there a way to
disable
this feature?Hi Mark

It is not clear what exactly the problem is here. Is the problem that you
have renamed the server without changing the instance name? In which case
you need to drop the server and re-create it as described in
http://msdn.microsoft.com/library/d...nstall_5r8f.asp
John

"Mark Delaney" <drsparc@.gmail.comwrote in message
news:1167352406.739648.91440@.s34g2000cwa.googlegro ups.com...

Quote:

Originally Posted by

When using the MS SQL 2005 JDBC driver, I now need to have the DNS name
resolution to the client correctly set up. If not I get the following
error:
>
SQLState: 08S01
SQLError: 0
Message: hostname : hostname
>
Where "hostname" is the client host name. It doesn't seem to matter if
I
use an IP address or hostname in my connection URL. When searching the
net,
I have seen a similar error, but not exactly the same, where the
message is
"Hostname: hostname not found" (once again, here "hostname" is the
client
machine) where they suggested the issue was the DNS name conflict.
>
I found the error goes away if the client machine's hostname match the
DNS
name used for the same IP addess that the DB server is using. One
work-around is to set hostname on the client to the IP address being
used.
>
I know the right thing to do is set the hostname and the DNS name
lookup the
same, but I have a customer who doesn't want to do this. They didn't
have to
for 2003, and they don't want to for 2005. Sigh. Is there a way to
disable
this feature?
>

|||Hey,

It isn't the database server name that is in question. The hostname of
the machine where the client is running is the issue. If I try and
make a JDBC connection from a machine where the hostname doesn't match
what the DB server's DNS lists it as, then the connection is rejected.
This didn't happen with the 2003 JDBC driver, so it looks like a new
security feature. But I would like to disable it.

- Mark

John Bell wrote:

Quote:

Originally Posted by

Hi Mark
>
It is not clear what exactly the problem is here. Is the problem that you
have renamed the server without changing the instance name? In which case
you need to drop the server and re-create it as described in
http://msdn.microsoft.com/library/d...nstall_5r8f.asp
>
John
>
"Mark Delaney" <drsparc@.gmail.comwrote in message
news:1167352406.739648.91440@.s34g2000cwa.googlegro ups.com...

Quote:

Originally Posted by

When using the MS SQL 2005 JDBC driver, I now need to have the DNS name
resolution to the client correctly set up. If not I get the following
error:

SQLState: 08S01
SQLError: 0
Message: hostname : hostname

Where "hostname" is the client host name. It doesn't seem to matter if
I
use an IP address or hostname in my connection URL. When searching the
net,
I have seen a similar error, but not exactly the same, where the
message is
"Hostname: hostname not found" (once again, here "hostname" is the
client
machine) where they suggested the issue was the DNS name conflict.

I found the error goes away if the client machine's hostname match the
DNS
name used for the same IP addess that the DB server is using. One
work-around is to set hostname on the client to the IP address being
used.

I know the right thing to do is set the hostname and the DNS name
lookup the
same, but I have a customer who doesn't want to do this. They didn't
have to
for 2003, and they don't want to for 2005. Sigh. Is there a way to
disable
this feature?

|||Hi Mark

"Mark Delaney" <drsparc@.gmail.comwrote in message
news:1167431063.785847.116630@.48g2000cwx.googlegro ups.com...

Quote:

Originally Posted by

Hey,
>
It isn't the database server name that is in question. The hostname of
the machine where the client is running is the issue. If I try and
make a JDBC connection from a machine where the hostname doesn't match
what the DB server's DNS lists it as, then the connection is rejected.
This didn't happen with the 2003 JDBC driver, so it looks like a new
security feature. But I would like to disable it.
>
>
- Mark


I am not sure why this would cause a problem when connecting to the server,
there must be some conversation being carried out! I would expect it to
cause problems for other applications as well, therefore you may want to
resolve the issue for those. I assume you can't change the hosts file on the
server? Your post in microsoft.public.sqlserver.jdbcdriver has had no
replies yet!

John

Connection reset error using JDBC

I see the following error randomly -

* SQLException during execution of sql-statement:
* sql statement was 'SELECT count(*) FROM PRODUCT_ATTRIBUTES A0 WHERE A0.PRODUCT_ID = ?'
* Exception message is [An exception occurred during the DBComms.receive method. Operation:Connection reset. ContextSad1) [Thread[pool-2-thread-1,5,main],

IO:18563, Dbc:c67b9]. PktNum:0. TotalReceived:0. PktSize:4,096.]
* Vendor error code [0]
* SQL state code [08S01]
* The root stack trace is -->
* com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred during the DBComms.receive method. Operation:Connection reset. ContextSad1)

[Thread[pool-2-thread-1,5,main], IO:18563, Dbc:c67b9]. PktNum:0. TotalReceived:0. PktSize:4,096.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
at com.microsoft.sqlserver.jdbc.DBComms.receive(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecutionRequest.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:293)
at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:72)
at org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:189)
at org.apache.ojb.broker.accesslayer.ReportQueryRsIterator.<init>(ReportQueryRsIterator.java:45)
at org.apache.ojb.broker.core.ReportRsIteratorFactoryImpl.createRsIterator(ReportRsIteratorFactoryImpl.java:59)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:2217)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getReportQueryIteratorFromQuery(PersistenceBrokerImpl.java:2252)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getReportQueryIteratorByQuery(PersistenceBrokerImpl.java:2177)
at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCount(PersistenceBrokerImpl.java:2148)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCount(DelegatingPersistenceBroker.java:383)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCount(DelegatingPersistenceBroker.java:383)
at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCount(DelegatingPersistenceBroker.java:383)
at org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.loadSize(CollectionProxyDefaultImpl.java:154)
at org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.size(CollectionProxyDefaultImpl.java:268)
at com.serus.common.caching.FlyWeight.getCollection(FlyWeight.java:272)
at com.serus.common.caching.FlyWeight.intercept(FlyWeight.java:125)
at com.serus.dto.core.ProductDTO$$EnhancerByCGLIB$$52ef9193.getProductAttributes(<generated>)
at com.serus.manager.scm.ModelManager.getProductAttributeForProductIdAttributeName(ModelManager.java:1664)
at com.serus.inca.outbound.PNAdapter.processTemplate6_New(PNAdapter.java:910)
at com.serus.inca.outbound.PNAdapter.runChildAdapter(PNAdapter.java:144)
at com.serus.inca.outbound.WSBaseAdapter.runAdapter(WSBaseAdapter.java:114)
at com.serus.inca.outbound.WorkstreamProcessor.startProcessor(WorkstreamProcessor.java:375)
at com.serus.inca.outbound.WorkstreamProcessor.call(WorkstreamProcessor.java:152)
at com.serus.inca.outbound.WorkstreamProcessor.call(WorkstreamProcessor.java:78)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)

My database and driver details are as below:

Database Product Version 9.00.1399

Driver Name Microsoft SQL Server 2005 JDBC Driver

Driver Version 1.1.1501.101

Driver Major Version 1

Driver Minor Version 1

It is a AMD 64 bit 2 dual core machine which is deployed with jdk 1.5 update 10.

Has anyone seen this before?

Thanks

-giriraj

We are also getting this. Have you made any progress? I posted the problem on the ms jdbc board.|||Are you using a single statement from multiple threads? Are you using distributed transactions? Can you try the CTP1 of the 1.2 release to see if it solves the issue.|||Yes, we are running in Tomcat, and multiple users on mutliple threads are running SQL statements through the JDBC driver.

I'm not sure if we can try the CTP driver, since the error is occurring during performance testing on a minor release of a productoin commerical product. We have been experimenting with different connection pool settigs. We are using the Apache Commons DBCP connection pool, and over extend and modify some of their classes. We tried validating the connection as we obtained it from the pool, and that seems to have solved the problem for now. This implies the connectioins are going bad while idle in the the pool.

What is different in the CTP driver that could help? By CTP1, do you mean the currently available version, or is there an different version?
|||

Currently, the publicly available released SQL Server 2005 JDBC driver is version 1.1. The CTP1 driver referenced above is the public beta release of the SQL Server 2005 JDBC v1.2 driver, which is available for download at http://msdn.microsoft.com/data/jdbc

Jimmy

|||The test is expensive. Why do you think the CTP1 driver might help?