Showing posts with label authentication. Show all posts
Showing posts with label authentication. Show all posts

Sunday, March 11, 2012

A Small Help Needed For a Beginner

I just want install ODBC driver for doing JDBC.How I must configure while installing SQl 2005 Express?.Which authentication I have to provide ?Whether Windows or SQL authentication?I want to connect jdbc odbc driver to my own system itself.

Thank You in advance.

There is no need to use an ODBC-JDBC bridge with SQL Server. You can download the latest JDBC driver here http://www.microsoft.com/downloads/details.aspx?familyid=f914793a-6fb4-475f-9537-b8fcb776befd&displaylang=en

You can learn about the driver here http://msdn.microsoft.com/data/learning/jdbc/

Reference documentation is here http://msdn.microsoft.com/data/ref/jdbc/

|||

import java.sql.*;
public class AuthorsInfo
{
public static void main(String args[])
{
try
{
String str="SELECT * FROM sudheer";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
/*Establish a connection with a data source*/
Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost;user=MyUserName;password=*****");
/*Create a Statement object to process the SELECT statement*/
Statement stmt=con.createStatement();
/*Execute the SELECT SQL statement*/
ResultSet rs=stmt.executeQuery(str);

while (rs.next())
{
System.out.println(rs.getString(1)+rs.getString(2)+rs.getString(3));

}
con.close();
}
catch(Exception ex)
{
System.out.println("Error occurred");
System.out.println("Error:"+ex);
}
}
}

I wrote the code and it is giving no class found error.Where to set the class path CLASSPATH =.;C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar?

How can I keep userid and password?

Thank You

Sunday, February 19, 2012

A problem with SQL Server Authentication?

Hi everybody...
I need to implement a publication but I got the next message when I start
the assistant: "SQL Server Agent on 'USER07' currently uses the system
account, which causes replication between servers to fail. In the following
dialog box, specify another account for the Service startup account". I
don't know which account I have to specify because the error persist. Do I
have to create a new account?
Thanks very much for any help!
Juan
juan,
if you're using replication across different boxes, you'll need a domain
user as the startup account for the SQL Server agent.
There's a few sections on this under Replication, Security in BOL.
HTH,
Paul Ibison
|||If I might just quibble with Paul's excellent answer.
For a push subscription the SQL Agent Account on the distribution must be
able to access the snapshot share on the publisher. This share is by default
\\PublisherServerName\C$\Program Files\Microsoft SQL
Server\MSSQL\ReplData\UNC
If your Publisher and Distributor are on the same server this is not a
problem.
Its only a problem when you are doing pull subscriptions, because then its
your SQL Server agent account on the Subscriber which must be able to map a
drive to
\\PublisherServerName\C$\Program Files\Microsoft SQL
Server\MSSQL\ReplData\UNC
So for this to work
1) your Subscriber must be part of the admin group on the Publisher, and you
select the impersonate the SQL Server Agent account on the Publisher
or
2) you change the share name to a share which the SQL Server agent account
on the subscriber can access and give permission to this account to access
the share and the underlying files and folders.
If you are in an untrusted domain you can use pass through authentication
http://support.microsoft.com/default...&Product=sql2k
and if you are an internet user you will have to use either the everyone
group/account (not recommended) or use FTP (recommended).
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:Om$SH07IEHA.228@.TK2MSFTNGP10.phx.gbl...
> juan,
> if you're using replication across different boxes, you'll need a domain
> user as the startup account for the SQL Server agent.
> There's a few sections on this under Replication, Security in BOL.
> HTH,
> Paul Ibison
>

Thursday, February 9, 2012

A few database issues

A few questions:

1. What is better security wise: sql authentication or windows authentication?

2. If I use windows authentication, which account is normally used for access? and how do I set this in the database as well as the web.config?
(I test locally, but when I place the live site at my hosting provider I want to make sure that the windows account I used for testing is supported by them)

Thanks!

PS. SQL Server is driving me crazy with its no-helping-weird errors...(or is that just me? ;) )

1. If you run SQL Server on WinNT, Windows Authentication may be better. Windows Authentication is also called 'trusted connection', which means SQL trusts current Windows account context; SQL Server achieves login security integration with Windows NT 4.0 or Windows 2000 by using the security attributes of a network user to control login access.

SQL Server Authentication is provided for backward compatibility. When a user connects with a specified login name and password (both stored in SQL Server) from a nontrusted connection, SQL Server performs the authentication itself.

For more information, you can visit this website:http://msdn.microsoft.com/library/en-us/adminsql/ad_security_47u6.asp?frame=true

2. Current Windows logon account is used for Windows Authenticatoin (if the machine is in a domain, some delegation may be performed by the domain controller). Local 'Administrator' account on the machine is mapped to 'BUILTIN\Administrators' login in SQL Server; and if you want to connect to a remote SQL Server with Windows Authentication, you have to add the Windows account to the SQL Server logins (use Enterprise Manager->'Security'->'Logins').

In a VS2005 starter kit web application there is something like this in web.config that looks like using Window Authentication (in green):

<connectionStrings>
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
</connectionStrings>

BTW, SQL Books Online provides some useful helping message, and more can be found inhttp://msdn.microsoft.com ^_^