错误提示:java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][Shared Memory]无效的连接。数据源连接的设置没有问题 设置完的测试也没有问题请问是怎么回事 谢谢
package demo;
/*
* 程序中连接数据源
*/
import java.sql.*;
public class Demo1 {public static void main(String[] args) {
Connection ct=null;
Statement sm=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ct=DriverManager.getConnection("jdbc:odbc:mytest");
sm=ct.createStatement();
}catch(Exception e){
e.printStackTrace();
}
finally{
try {
if(sm!=null){
sm.close();
}
if(ct!=null){
ct.close();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}}
package demo;
/*
* 程序中连接数据源
*/
import java.sql.*;
public class Demo1 {public static void main(String[] args) {
Connection ct=null;
Statement sm=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ct=DriverManager.getConnection("jdbc:odbc:mytest");
sm=ct.createStatement();
}catch(Exception e){
e.printStackTrace();
}
finally{
try {
if(sm!=null){
sm.close();
}
if(ct!=null){
ct.close();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}}
解决方案 »
- java 车牌号识别
- 最近初学Swing做功能的时候遇到的问题,希望能帮忙解决下。
- 如何用 键盘事件 控制在窗口开始自动画图?
- 哪位可以帮我解释一下里面程序的运行过程吗?谢谢!
- import c:\java\A.class 失败,不知道为什么?
- 在网页上显示用户客户端的硬盘信息??
- j2se帮忙差错!谢谢,公有函数点不出来!急
- 解释几个installanywhere的名词
- 请问jbuilder中,"Warning #:check sourcepath;..." 908 是什么含义
- 在一台单网卡双IP的服务器上开发socket程序,为监听其中一个IP的端口,ServerSocket应如何写?
- I want to be a 架构师
- 求java聊天软件,来信息时头像闪动的原理
应该是这个的问题吧