Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 27, 2007, 01:37 AM   #1
ashokformac
macrumors member
 
Join Date: Mar 2007
java jdbc connection to sql server

Hi , i am new to mac. i am using java jdbc connection to access the data in ms sql server.I am using jTDS jdbc driver and mac 10.4 . I am not able to connect to sql server .
following are the lines i used for connection ..

Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:jtds:sqlserver://172.16.4.59/iarchivev2;user=iarchiveuser;password=system");

but connection was not establishing...
it say unable to connect to remote host..

can any one help me to solve this problem...
ashokformac is offline   0 Reply With Quote
Old Mar 27, 2007, 03:23 AM   #2
lazydog
macrumors 6502a
 
Join Date: Sep 2005
Location: Cramlington, UK
Send a message via MSN to lazydog
Hi

Don't you have to call newInstance() on the class?

eg

Class.forName( "com.mysql.jdbc.Driver" ).newInstance() ;

Well that's what I do at any rate.


b e n
lazydog is offline   0 Reply With Quote
Old Mar 27, 2007, 04:01 AM   #3
ashokformac
Thread Starter
macrumors member
 
Join Date: Mar 2007
hi thank you for your reply,

still it is not working .. the following error occurs

Network error IOException: Operation timed out

can any one help me ?
ashokformac is offline   0 Reply With Quote
Old Mar 27, 2007, 04:42 AM   #4
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by lazydog View Post
Hi

Don't you have to call newInstance() on the class?

eg

Class.forName( "com.mysql.jdbc.Driver" ).newInstance() ;

Well that's what I do at any rate.


b e n
You don't have to call newInstance(). I use JDBC a lot at work connecting to Sybase enterprise database servers. We don't call newInstance(). When you ask for a connection the JDBC libraries automatically create an instance for you if needed. You simply have to ensure that the class has been loaded into the current JVM session. Which is what Class.forName does.

As for why it does not work: did you read and consider the error? It's not apparently a code problem. It is telling you that it did not receive a response from the server specified. Can you ping that IP address?
robbieduncan is offline   0 Reply With Quote
Old Mar 27, 2007, 04:58 AM   #5
ashokformac
Thread Starter
macrumors member
 
Join Date: Mar 2007
ping

no i am not able to connect using ping....
ashokformac is offline   0 Reply With Quote
Old Mar 27, 2007, 05:04 AM   #6
lazydog
macrumors 6502a
 
Join Date: Sep 2005
Location: Cramlington, UK
Send a message via MSN to lazydog
Quote:
Originally Posted by robbieduncan View Post
You don't have to call newInstance(). I use JDBC a lot at work connecting to Sybase enterprise database servers. We don't call newInstance(). When you ask for a connection the JDBC libraries automatically create an instance for you if needed. You simply have to ensure that the class has been loaded into the current JVM session. Which is what Class.forName does.
Thanks for the info… much appreciated!

b e n
lazydog is offline   0 Reply With Quote
Old Mar 27, 2007, 05:43 AM   #7
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by ashokformac View Post
no i am not able to connect using ping....
Well if you can't ping it (this is not connecting, simply sending a packet and seeing if the address replies) then you cannot see that machine at a network level. Either the address does not exist or there are firewalls between you and it that are preventing you from talking to it. Is it a Uni server and you are outside the Uni network perhaps?
robbieduncan is offline   0 Reply With Quote
Old Mar 27, 2007, 08:02 AM   #8
ashokformac
Thread Starter
macrumors member
 
Join Date: Mar 2007
thanks

thank you very much for your suggestions...
ashokformac is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Unable to connect to Windows server with SMB2 lenw Mac OS X 10.7 Lion 0 Nov 18, 2011 06:08 PM
Why does Mac OS say 3 users are connected to my shares? I'm the only one connected? alexreich Mac OS X Server, Xserve, and Networking 7 Oct 2, 2011 02:16 PM
Connect to SQL Server database from Cocoa application Jose Jayan Mac Programming 2 Jun 9, 2009 12:39 PM
Connecting to SQL Server with Objective-C Monkaaay Mac Programming 5 Dec 30, 2008 11:07 AM
Connect to SQL server remotely? nerveosu General Mac Discussion 0 May 14, 2002 09:05 PM


All times are GMT -5. The time now is 12:06 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC