关于SqlServer2005的jdbc连接的TCP/IP错误问题解决

解决方案(自己照图配置,ok)
   打开SQL Server Configuration Manager,然后按如下图的配置:



VIA一定不就要开,否则,服务重启不了,我的是这样!



   
网络方案(仅供参考)
在 SQL Server 2005 里面,如果出现到主机的 TCP/IP 连接失败。
java.net.ConnectException: Connection refused: connect!
首先是因为sqlserver2005默认情况下是禁用了tcp/ip连接。
您可以在命令行输入:telnet localhost 1433进行检查,这时会报错:正在连接到localhost...不能打开到主机的连接,在端口 1433: 连接失败
启动tcp/ip连接的方法:
打开 \Microsoft SQL Server 2005\配置工具\目录下的SQL Server Configuration Manager--->网络配置选择mssqlserver协议, 然后右边窗口有个tcp/ip协议,然后启动它,把sqlserver服务停了,然后在启动。问题就解决了!
这时在命令行输入:telnet localhost 1433就不会再报错了,窗口显示为一片黑,即为正常



特例:
1,打开SQL server configuration manager--->网络配置--->Tcp/Ip,右键选择开启Tcp/IP
2,双击修改Tcp/IP端口号。注意不是所有机器的端口号都是1433,打开Tcp/Ip界面后,先查看最底下一栏的动态端口号是多少,像我的机器就是2921.在这儿纠结了很久,原先全部的时间都浪费在把端口设置成1433!!
然后把上面所有的动态端口号都改为2921(你自己机器的动态端口号),所有Enable的选项都选YES。然后应用,确定。
附:我是索性把所有的不论动态端口还是端口都设成了2921,调了半天,生气了!
3,重启数据库连接服务。
然后在命令行输入:telnet localhost 端口号,如果窗口不显示连接不上,出来一个黑屏,那么就表示连接成功了。
然后去你写的类里面连接数据库吧,起码不会再有“到主机的TCP/IP连接失败”的问题了!
  • 大小: 372.6 KB
  • 大小: 187.4 KB
Transact-SQL, or T-SQL, is Microsoft Corporation’s powerful implementation of the ANSI standard SQL database query language, which was designed to retrieve, manipulate, and add data to relational database management systems (RDBMS). You may already have a basic idea of what SQL is used for, but you may not have a good understanding of the concepts behind relational databases and the purpose of SQL. This book will help you build a solid foundation of understanding, beginning with core relational database concepts and continuing to reinforce those concepts with real-world T-SQL query applications. If you are familiar with relational database concepts but are new to Microsoft SQL Server or the T-SQL language, this book will teach you the basics from the ground up. If you’re familiar with earlier versions of SQL Server, it will get you up-to-speed on the newest features. And if you know SQL Server 2005, you’ll learn about some exciting new capabilities in SQL Server 2008. Information Technology professionals in many different roles use T-SQL. Our goal is to provide a guide and a reference for IT pros across the spectrum of operational database solution design, database application development, and reporting and business intelligence solutions. Database solution designers will find this book to be a thorough introduction and comprehensive reference for all aspects of database modeling, design, object management, query design, and advanced query concepts. Application developers who write code to manage and consume SQL Server data will benefit from our thorough coverage of basic data management and simple and advanced query design. Several examples of ready-to-use code are provided to get you started and to continue to support applications with embedded T-SQL queries. Report designers will find this book to be a go-to reference for report query design. You will build on a thorough introduction to basic query concepts and learn to write efficient queries to support business reports and advanced analytics. Finally, database administrators who are new to SQL Server will find this book to be an all-inclusive introduction and reference of mainstream topics. This can assist you as you support the efforts of other team members. Beyond the basics of database object management and security concepts, we recommend Beginning SQL Server 2005 Administration and Beginning SQL Server 2008 Administration from Wrox, co-authored in part by the same authors. This book introduces the T-SQL language and its many uses, and serves as a comprehensive guide at a beginner through intermediate level. Our goal in writing this book was to cover all the basics thoroughly and to cover the most common applications of T-SQL at a deeper level. Depending on your role and skill level, this book will serve as a companion to the other Wrox books in the Microsoft SQL Server Beginning and Professional series.. This book will help you to learn: * How T-SQL provides you with the means to create tools for managing databases of different size, scope, and purpose * Various programming techniques that use views, user-defined functions, and stored procedures * Ways to optimize query performance * How to create databases that will be an essential foundation to applications you develop later Each section of this book organizes topics into logical groups so the book can be read cover-to-cover or can be used as a reference guide for specific topics. We start with an introduction to the T-SQL language and data management systems, and then continue with the SQL Server product fundamentals. This first section teaches the essentials of the SQL Server product architecture and relational database design principles. This section (Chapters 1–3) concludes with an introduction to the SQL Server administrator and developer tools. The next section, encompassing Chapters 4 through 9, introduces the T-SQL language and teaches the core components of data retrieval, SQL functions, aggregation and grouping, and multi-table queries. We start with the basics and build on the core structure of the SQL SELECT statement, progressing to advanced forms of SELECT queries. Chapter 10 introduces transactions and data manipulation. You will learn how the INSERT, UPDATE, and DELETE statements interact with the relational database engine and transaction log to lock and modify data rows with guaranteed consistency. You will not only learn to use correct SQL syntax but will understand how this process works in simple terms. More advanced topics in the concluding section will teach you to create and manage T-SQL programming objects, including views, functions, and stored procedures. You learn to optimize query performance and use T-SQL in application design, applying the query design basics to real-world business solutions. Chapter 15 contains a complete tutorial on using SQL Server 2008 Reporting Services to visualize data from the T-SQL queries you create. The book concludes with a comprehensive set of reference appendixes for command syntax, system stored procedures, information schema views, file system commands, and system management commands. The material in this book applies to all editions of Microsoft SQL Server 2005 and 2008. To use all the features discussed, we recommend that you install the Developer Edition, although you can also use the Enterprise, Standard, or Workgroup editions. SQL Server 2005 Developer Edition or SQL Server 2008 Developer Edition can be installed on a desktop computer running Windows 2000, Windows XP, or Windows Vista. You can also use Windows 2000 Server, Windows Server 2003, or Windows Server 2008 with the Enterprise or Standard edition. The SQL Server client tools must be installed on your desktop computer and the SQL Server relational database server must be installed on either your desktop computer or on a remote server with network connectivity and permission to access. Consult www.microsoft.com/sql for information about the latest service packs, specific compatibilities, and minimum recommend system requirements. The examples throughout this book use the following sample databases, which are available to download from Microsoft: the sample database for SQL Server 2005 is called AdventureWorks, and the sample database for SQL Server 2008 is called AdventureWorks2008. Because the structure of these databases differs significantly, separate code samples are provided throughout the book for these two version-specific databases. An example using the AdventureWorks2008DW database for SQL Server 2008 is also used in Chapter 15.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值