[Microsoft][ODBC SQL Server Driver][SQL Server]解析得到的定位器无效

yangyinbo 2008-04-14 09:36:51
以下是源代码:问题描述如题。
import java.sql.*;
import java.io.*;
public class myJdata2
{
public static void main(String args[])
{



String DriverName="sun.jdbc.odbc.JdbcOdbcDriver";
String DBURL="jdbc:odbc:Student";
Connection conn=null;
Statement stmt;


try{
Class.forName(DriverName);
}
catch(ClassNotFoundException e)
{
System.out.println("无法加载JDBC驱动程序"+e);
return ;
}
catch(Exception e)
{
System.out.println(e.getMessage());
return;
}
try{
conn=DriverManager.getConnection(DBURL,"sa","");
stmt=conn.createStatement();

String sql;
FileInputStream str=new FileInputStream("C++.doc");
sql="insert into student (gongshi) values(?)";
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setBinaryStream(1,str,str.available());
System.out.print("1111111111");
pstmt.executeUpdate();

}
catch(SQLException e){System.out.println(e.getMessage());}
catch(Exception e){System.out.println(e.getMessage());}
finally{
if(conn!=null)
{
try{conn.close();}
catch(Exception e) {e.printStackTrace();}
}
}
}
}
...全文
96 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
老紫竹 2008-04-17
  • 打赏
  • 举报
回复
使用 JDBC 代替你的 JDBC-ODBC桥
yangyinbo 2008-04-17
  • 打赏
  • 举报
回复
不知道楼上说的什么?请帮忙!
goodmrning 2008-04-15
  • 打赏
  • 举报
回复
到这里去看看
http://www.java2000.net/viewthread.jsp?tid=463
wanghao111 2008-04-14
  • 打赏
  • 举报
回复
交流群 C++ java 36414176

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧