473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SqlException

58
hi,
my java code:
****************
Expand|Select|Wrap|Line Numbers
  1.  import java.sql.*; 
  2. public class sqljdbc
  3. {
  4. public static void main(String[] args) 
  5. {
  6. try
  7. {
  8. String url = "jdbc:microsoft:sqlserver://";
  9. //String serverName = "localhost";
  10. String serverName = "ow8";
  11. String portNumber = "1433";
  12. String databaseName = "sundar";
  13. String userName = "sa";
  14. String password = "sa";
  15. String selectMethod = "cursor"; 
  16. //String url="jdbc:microsoft:sqlserver://"+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";,"+userName+","+password;
  17. Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
  18. Connection conn = DriverManager.getConnection(url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";",userName,password);
  19. //Connection conn = DriverManager.getConnection(url);
  20. Statement st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
  21. ResultSet rs=st.executeQuery("select * from paging");
  22. while(rs.next())
  23. {
  24. System.out.println(rs.getString(1));
  25. }
  26. catch (Exception e)
  27. {
  28. e.printStackTrace();
  29.  
  30. }
  31. }
  32. }
  33.  
EXCEPTION GOT:
*********************

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createExcep tion(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<in it>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnecti on.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplC onnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknow n Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:525)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at sqljdbc.main(sqljdbc.java:18)

can any one resolve this exception?????????????

thanks in advance.............
Apr 23 '07 #1
6 1819
r035198x
13,262 8TB
There could be several reasons for this error. Try the suggestions here and post if there is still a problem.
Apr 23 '07 #2
gsuns82
58
There could be several reasons for this error. Try the suggestions here and post if there is still a problem.
thanks 4 ur reply,
I have followed the instructions which are given in www.websina.com but still getting the same problem....can u guide me further??? any other solutions???
Apr 23 '07 #3
JosAH
11,448 Expert 8TB
Print out that complicated String before you pass it on to the getConnection()
method. Check if it is correct; it seems it isn't.

kind regards,

Jos
Apr 23 '07 #4
gsuns82
58
Print out that complicated String before you pass it on to the getConnection()
method. Check if it is correct; it seems it isn't.

kind regards,

Jos


I tried the following connection url suggested by Microsoft.com but still having the same problem..

connection urls wic i tried:::
********************************
jdbc:microsoft:sqlserver://localhost:1433;databaseName=sundar;UserName=sa;Pas sword=sa

any idea on this url????

regards,
suns82.
Apr 23 '07 #5
JosAH
11,448 Expert 8TB
This may seem trivial but check it out nevertheless:

- is your database engine running?
- does it listen to the port you mentioned?
- does a user 'sa' (the same password) exist?
- try 127.0.0.1 instead of localhost.

kind regards,

Jos
Apr 23 '07 #6
gsuns82
58
This may seem trivial but check it out nevertheless:

- is your database engine running?
- does it listen to the port you mentioned?
- does a user 'sa' (the same password) exist?
- try 127.0.0.1 instead of localhost.

kind regards,

Jos
thanks Jos,i have tried things wat u mentioned except dns '127.0.0.1',let me try this,this can the final hope...

regards,
sundar.
Apr 24 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: sumithradevi | last post by:
Hello Friends, I am getting the following error. java.sql.SQLException: ORA-00020: maximum number of processes (100) exceeded I am closing all my resultsets and all my connections in the try...
2
by: stanley J mroczek | last post by:
System.Data.SqlClient.SqlException: General network error. Check your network documentation. I know that this is not much to go on. But I don't know where to start. the program updates 186 records...
0
by: Eckard Buchner | last post by:
Hi, we have a query that returns only a few rows, but has a lot of columns in group by clause. In some cases we receive an SQL Exception. Here is the trace setString (1, 20040928001) called...
1
by: Dave | last post by:
Hi, I am trying to trap a SQLException erro in my Global.asax file but I am unable to do it. In my Application_Error code block I have a simple response.write followed by a response.end but...
3
by: Mr.KisS | last post by:
Hello all, I'm working with : WinXP PRO SP1, MS SQL 2005 Express, Visual Web Dev 2005 Express. I have an aspx page which must execute a stored procedure : ______________ try {...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
2
by: Dan Holmes | last post by:
I don't know how to troubleshoot this one. src is after the error. "System.Data.SqlClient.SqlException: XML parsing: line 1, character 698, illegal qualified name character\r\n at...
8
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive...
1
by: thithi | last post by:
Please help me " System.Data.SqlClient.SqlException: Prepared statement '(@Name varchar(100),@Describes varchar(100),@Money char(10))Upda' expects parameter @Describes, which was not supplied. at...
9
by: freethinker | last post by:
Hi, I have a database class I use to get and drop db connections: public class Database { protected static Connection c; //.... /// .. c = DriverManager.getConnection .... ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.