hello viewers.


i have some problems in java database connectivity.

the code compiles successfully but , when i execute the code it gives this error " error establishing socket connection".

i have applied several solutions e.g enable tcp/ip in sql server, checking the name of sql server., giving ip to network card(though i am working on a single pc no connectivity to network is available)., used mixed mode sql server authentication., used new login and passwords.

when i execute netstat on dos prompt no protocol or socket no is listed.
when i use telnet(computername) 1433 , it cannot make connection.

these are all the work which i have done but there is no result.

plz help me in this case.
thanks.

What type of jdbc connection u used in ur program. please use jdbc-odbc bridge connection to ur sql server. So fst u create the DSN. after u that name in ur prg.

commented: The JDBC-ODBC bridge is the worst driver among all the four types, you should not recommend. +0

No, do not use the JDBC-ODBC Bridge. Use the actual JDBC Driver whenever there is one available.

@OP Have you configured your Windows Firewall to allow connections to that port?

i think U cannt use JDBC connection with SQL Server. Search some thing abt this

commented: Continues to ignore the "no text-speak" policy. Use actual English or don't bother. -2

Yes, you can. There are JDBC Drivers available for SQL Server.

Have you created a data source for your Database on the SQL Server?

thanks for the reply.

i am using the original jdbc driver from microsoft. i connect to the sqlserver 2000.


i have alsor tried the solution of allowing the firewall of windows xp to "off" state.

no i am going to try dsn , and then inform all of u.

thx for replying.

do NOT use ODBC!

you're having network problems. Either the server refuses your connection at the network level, your JDBC URL is incorrect (pointing to something where there is no server for example), your client refuses the connection (unlikely if you've turned off the firewall on it), or something else in your network blocks the traffic.

How are u trying to connect to the SQL server database, using which protocol ?
TCP/IP or via NamedPipes,
Check whether the method u r trying is enabled on the SQL Server you are trying to connect to.

How are u trying to connect to the SQL server database, using which protocol ?
TCP/IP or via NamedPipes,
Check whether the method u r trying is enabled on the SQL Server you are trying to connect to.

Sorry had not read the complete post !!!

when i execute netstat on dos prompt no protocol or socket no is listed.
when i use telnet(computername) 1433 , it cannot make connection.

Try using namedPipes, instead of TCP connection (its supposed to be faster if your server is on the same machine as it would bypass the network layer) for connecting to your SQL Server.

hello

what is the driver name for connecting to sql server and where can i find the jar file.

write some sample code


thnx

Microsoft has one as well: http://msdn.microsoft.com/en-us/data/aa937724.aspx

As masijade said, this info takes mere seconds to find with Google - use it. If you encounter difficulties finding an answer then post a question.

We certainly aren't going to "write some sample code" for you, if you can't even take the time to search on it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.