Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 27, 2007, 02: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, 04: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, 05: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, 05: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, 05: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, 06: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, 06: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, 09: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

Similar Threads
thread Thread Starter Forum Replies Last Post
air video server app , Clamxav java exploit Che Castro Apple TV and Home Theater 2 Jun 25, 2013 03:45 PM
Software similar to SQL Dev and SQL plus? doomfront Mac Basics and Help 0 Nov 20, 2012 01:25 PM
Sync sqlite with sql server RookieAppler iPhone/iPad Programming 2 Oct 19, 2012 01:09 PM
New to Objective C - and wanting to access a sql server web service. sshouler Mac Programming 1 Oct 15, 2012 05:09 PM
Server Connection MaxRumors OS X 0 Jul 11, 2012 12:40 AM

Forum Jump

All times are GMT -5. The time now is 06:08 AM.

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

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