Topic: 请大家帮忙 (jTurbo 连接 SQL Server 2000)

  Print this page

1.请大家帮忙 (jTurbo 连接 SQL Server 2000) Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-08 18:29

这个程序找到到连接用的驱动程序是SQL Sever2000的,请帮我一下。
/*连接到SQL Sever 2000的数据库*/

import java.sql.*;
import java.io.*;
import java.util.*;

public class ContoSQL
{
public static void main(String args[])
{
String url="jdbc:JTurbo://localhost:1433/student";
//上一语句表示连接的是本机上1433端口名为student的数据库
//其中1433是SQL Sever默认的端口
Connection con=null;
Statement sm=null;
String command=null;
try
{
DriverManager.registerDriver(new com.ashna.jturbo.driver.Driver());
System.out.println("驱动程序已加载");
con=DriverManager.getConnection(url,"SA","a");
//"SA"是SQLSever的系统管理员账户,密码是"a"
System.out.println("OK:已成功连接到数据库");
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
return;
}
}
}

2.Re:请大家帮忙 (连接 SQL Server 2000) [Re: haoyue] Copy to clipboard
Posted by: why
Posted on: 2004-08-08 20:59

请尽量用准确的文字描述作为标题

What kind of help do you need?

>> con=DriverManager.getConnection(url,"SA","a");
>> //"SA"是SQLSever的系统管理员账户,密码初始值是空
Then why would you put an "a" there?

>> DriverManager.registerDriver(new com.ashna.jturbo.driver.Driver());
What's the version of the driver?
http://www.newatlanta.com/products/jturbo/self_help/docs/pre_3x/installation_notes.jsp

3.Re:请大家帮忙 (jTurbo 连接 SQL Server 2000) [Re: haoyue] Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-08 22:25

'a'是密码,我想大家能帮我用这个程序连接到SQL Sever 的数据库上

问题是程序运行后报错:找不到com.ashna.jturbo.driver.Driver()这个

我就是想问,连接SQL Sever 2000的驱动程序的路径,放在哪个包里的。


{ please use the Edit functionality for such short messages posted within a short period of time. Thanks. -- why }

4.Re:请大家帮忙 (jTurbo 连接 SQL Server 2000) [Re: haoyue] Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-08 22:45

谢谢您的指教,我用了下面的话语可还是不靠呀!
com.newatlanta.jturbo.driver.Driver()
报的工错误是:
ContoSQL.java [19:1] package com.newatlanta.jturbo.driver does not exist
DriverManager(new com.newatlanta.jturbo.driver.Driver());
望指教!

5.Re:请大家帮忙 (jTurbo 连接 SQL Server 2000) [Re: haoyue] Copy to clipboard
Posted by: why
Posted on: 2004-08-08 23:31

haoyue wrote:
'a'是密码,我想大家能帮我用这个程序连接到SQL Sever 的数据库上

but you said 密码初始值是空 -- well, 初始值


Come on, please tell us which version of jTurbo you are using.
You have to put the required jar(s) in the classpath -- well, which jar(s) are required? check the link I posted above, and if necessary, the proper documentation (there's a link on that page).

Uncompress the JTurbo archive to a directory. Place JTurbo.jar in the
classpath of your application. If you are using JTurbo 2.0 Enterprise with
JDK 1.2.x then you must also add jndi.jar and jdbc2_0-stdext.jar to the
classpath of your application. These JAR files will be located in the JTurbo
lib directory.

6.Re:请大家帮忙 (jTurbo 连接 SQL Server 2000) [Re: haoyue] Copy to clipboard
Posted by: haoyue
Posted on: 2004-08-09 09:34

我使用的是j2sdk1.4.2_05,可它老说没有呀?
关于密码的事,是我打字时打错了,不好意思。
请问我到哪才能获得JTurbo.jar 呢?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923