jtds

public DBConnection(){

try{

Class.forName("net.sourceforge.jtds.jdbc.Driver");

String url = "jdbc:jtds:sqlserver://localhost:1433/test;user=root;password=123456";

Connection con = DriverManager.getConnection(url);

}catch(Exception ex){

ex.printStackTrace();

}

}

public static void main(String args[]){

try{

DBConnection db = new DBConnection();

}catch(Exception ex){

ex.printStackTrace();

}

}

}

/*************/

public DBConnection(){

try{

Class.forName("net.sourceforge.jtds.jdbc.Driver");

String url = "jdbc:jtds:sqlserver://localhost:1433/test";

Connection con = DriverManager.getConnection(url,"root","123456");

}catch(Exception ex){

ex.printStackTrace();

}

}

public static void main(String args[]){

try{

DBConnection db = new DBConnection();

}catch(Exception ex){

ex.printStackTrace();

}

}

}

I have tried all combinations. Always i am getting

java.sql.SQLException: Login failed for user 'root'.

at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)

at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)

at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)

at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:599)

at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:331)

at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:181)

at java.sql.DriverManager.getConnection(DriverManager.java:543)

at java.sql.DriverManager.getConnection(DriverManager.java:194)

..

..

..

I am using mysql administrator and i am logging on using user name root and password 123456 so password and user name exist. where is the problem.

help pls,

[1924 byte] By [coffeebrowna] at [2007-10-2 12:41:46]
# 1

Why are you using jTDS to connect to MySQL and not MySQL Connector/J?

http://www.mysql.com/products/connector/j/

I thought jTDS was for connecting to Microsoft SQL Server and Sybase.

Look at the URL you're using: it says "sqlserver".

You're connecting to port 1433. That's the SQL Server default; the MySQL default is 3306.

What database are you trying to connect to - SQL Server or MySQL? The fact that you're using MySQL Admin is confusing me. If you're using SQL Server, why would you not use its admin tool?

It might be possible to connect to MySQL using jTDS, but I've never done it.

"java.sql.SQLException: Login failed for user 'root'."

You might think that the user root is set up, but the database disagrees with you. I though the admin password for SQL server was "sa". You're assuming something that's incorrect. Check your assumptions.

%

duffymoa at 2007-7-13 9:47:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> It might be possible to connect to MySQL using jTDS,

> but I've never done it.

>

It is not possible.

The jTDS driver can be used to connect to databases that use the TDS proctocol. This means MS SQL Server and Sybase.

But not MySQL.

What is up with all the recent confusion about this. We had a guy yesterday trying to connect to Access with an Oracle driver and now this? Is this really so hard to comprehend?

I mean would these same people complain that they can't use their mouse driver for their sound card?

duffymoa at 2007-7-13 9:47:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

> > It might be possible to connect to MySQL using

> jTDS,

> > but I've never done it.

> >

>

> It is not possible.

>

> The jTDS driver can be used to connect to databases

> that use the TDS proctocol. This means MS SQL Server

> and Sybase.

>

> But not MySQL.

The voice of reason. Thanks, scsi. I didn't think it was possible, but I thought I'd leave the door open for doubt in case I was being ignorant. 8)

>

> What is up with all the recent confusion about this.

> We had a guy yesterday trying to connect to Access

> with an Oracle driver and now this? Is this really

> so hard to comprehend?

LOL! I guess it is.

> I mean would these same people complain that they

> can't use their mouse driver for their sound card?

"I have a problem. I've got my car keys in my hand, and I keep hitting the 'unlock' button, but I still can't get into my house. Can anyone help? Is it a bug in the JVM? Plz hlp. Thx."

%

duffymoa at 2007-7-13 9:47:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

> "I have a problem. I've got my car keys in my hand,

> and I keep hitting the 'unlock' button, but I still

> can't get into my house. Can anyone help? Is it a

> bug in the JVM? Plz hlp. Thx."

With a subject line of "URGENT PROBLEM!!!" and a self-followup 30 minutes later:

"Y no help? URGNT!!!!! I need 2 P!!!"

StuDerbya at 2007-7-13 9:47:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
"Still can't get inside. Pls help. It's cold, and I have to pee."%
duffymoa at 2007-7-13 9:47:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...