Click to See Complete Forum and Search --> : windows authentication,sql server and java


szopdog
June 6th, 2003, 11:45 AM
Hi there,
so... can you help me out?
I'm trying to use windows authentication to connect to sql server
from my java app. Needless to say with not much success.
I hope you can at least point me in the right direction if not
give me the solution out right.
So far i've downloaded a free jar file called jcifs and have been
able to authenticate my windows username and password with
the domain controller.
Now how in the world do i use that to connect to sql server and
get some data in and out of it?

Goodz13
June 6th, 2003, 02:21 PM
From my understanding, the jcifs package is used only to share files simular to SAMBA and not connect to an SQL server.

What is your SQL server?

To connect to an SQL server on a different computer, you'll probably have to setup users and user rights for the DB that you are trying to connect to.

Have a look at the JDBC-ODBC bridge. Here's a tutorial (http://java.sun.com/docs/books/tutorial/jdbc/basics/connecting.html).

Your connection would probably look simular to this:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// url = Driver://IPAddress:port/database
String url = "jdbc:odbc://192.168.0.3:4333/MyDb";
Connection con = DriverManager.getConnection(url, "MyUser", "MyPassword");


I hope some of this helps

szopdog
June 6th, 2003, 02:31 PM
I know how to connect to a sql server using jdbc and sql authentication. What i want to do is to connect to sql server
through jdbc (or some other way) using windows authentication.
(my domain identity to be precise).

t_yu72
June 25th, 2003, 01:48 PM
hi there,

I am new to java programming. Hope I can get your help.
I am also writing an java application that need authenticate my windows username and password with or without
the domain controller, could you please share with me how you do that?

many thanks.