Friday, March 30, 2012

Need help connecting java to mssql, I'm even lost at install

Hello,

Hope anyone in here can help.
I have tried to install the SQL Server 5 Express, but can't seem to get it to work properly.
I got a terrible name set as default for my database, as well as a terrible name for my username.
I can't find a place to change this to something more manageable.

It is further set to windows auth, but trying to set it to both, and trying a username (and password) always gives me a log in error.

I've tried searching all over the net and in here for a simple tutorial, but can't seem to find one that helps me more than it confuses me.

*****
The second part of the problem is that I have a java program which I want to connect to the database and use the tables in it, but I am at loss to how I can find what username (and password) I am supposed to have, what "url" it needs etc.
I have the jdbc driver so that part should work, I can successfully log to other mssql databases (at work/school), but not my own.

Hope you can help, and thanks in advance.

Hi,

to change a database name

alter database testdb

modify name = TestTmpDB

go

and to chagne user name

alter user AbolrousHazem

with Name = TempTestUser

go

while connecting to SQL Server from Java which error you get? you have wrote that you have set it with Windows Authentication, have you cross checked with Connectilon String?

HTH

Hemantgiri S. Goswami

|||

Hi Murky,

I would encourage you to use the SQL Server 2005 JDBC Driver. You can download it from here: http://msdn2.microsoft.com/en-us/data/aa937724.aspx. To connect to SQL Server using the driver, please refer to the section of that page regarding building the Connection String http://msdn2.microsoft.com/en-us/library/ms378428.aspx. Note, connection string and url are synonyms. There are also many sample java applications available at the first link too.

Note that you can connection to SQL Server using two methods:

1. Username and Password Credentials

2. Windows Authentication.

To do a windows authenticated connection, the server should have been setup with "mixed-mode authentication". If you installed with all the default options, this feature was not installed then. If it was not then you need to use your username/password credentials or reconfigure the server to use mixed-mode authentication.

Hope this helps.

Regards,

Jaaved Mohammed

No comments:

Post a Comment