Friday, February 17, 2012

create db with script

I have an .sql script that I am using to create my db in sql2000. I am creating it as the sa user. In this script, I am also creating a user and putting them in the db_owner role. Upon load of data, I am the user I made.

I keep getting an error :

file:C:/Projects/CanidateManager/scripts/ant/targets-sql.xml:32: java.sql.SQLException: Lo
gon failed. Msg 18456, Severity 14, State 1, Login failed for user 'sa'., Server , Proced
ure , Line 0
at org.apache.tools.ant.taskdefs.JDBCTask.getConnecti on(JDBCTask.java:352)
at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLE xec.java:358)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:30 9)
at org.apache.tools.ant.Target.performTasks(Target.ja va:336)
at org.apache.tools.ant.Project.executeTarget(Project .java:1339)
at org.apache.tools.ant.Project.executeTargets(Projec t.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)

What am I doing wrong? I am not a database person persay so I have exhausted all my resources.check the security mode of your sql box.|||You don't show how you're executing it...why not use osql?

Where are you executing this from as well

Why do you need to have a database built by a front end (just a guess)|||It is not from a front end but part of the installation when we send the software out to a new environment. I need to build the database and load it with needed data. I have an sa in the security folder with a password of sa with public and db_owner. I am calling this script with an ant build target.|||Whats an ant build target?

I just use osql.exe|||is any gui involved in your installation? or you've hard-coded sa pwd into a script?|||When I installed the sql server on my box, I created the sa user with password. So no, there is no gui to do this. Maybe I am missing something.|||wait a minute, you've "created" sa user???|||I do have a properties file that has the sa and password info in it so the script does not have any actual hard coding just a token. I'm using these just to assign who the user is when creating.|||When I installed the sql it created the sa. I just made the password sa as well.|||oh, that's reassuring :)

make sure you have either sql standard or mixed security mode enabled on the server.|||How do I check that from Enterprise manager?|||Right click on the server, Select properties and look at the security tab|||It is set to both sql and windows authentication.|||So if that is set correctly, any other suggestions as to my issue?|||Originally posted by rjkimme
When I installed the sql it created the sa. I just made the password sa as well.

Not a good idea...

You should create another user and grant it sa...

Then take sa and strip it of all rights...

and you shouldn't tell us what the password is...

esp on a public board...

(What's the ip? just kidding)

Maybe if you post the command your executing...|||Another issue because I may have solved my previous problem. Is there a programmatic way to create a logon for a database?|||Look up sp_addlogin sp_adduser in bol|||Instead of worrying over the password, would it be possible to assume an administrator is doing the install, and use a trusted connection with his rights? Not sure if that works in most/all environments, but it sounds like a safe bet. You just ahve to make sure that you are dropping tables into the correct database. I had to help a guy get his application out of the master database a few years back, and it was not pretty.|||Miracles do happen. It works. Thanks so much for your help and time.|||Originally posted by rjkimme
Miracles do happen.

uhhh...no

But that's great!

Way to stick with it!

And now...its almost time..

DECLARE @.Weekend datetime
SELECT @.Weekend = 'Nov 14 2003 17:00:00'
SELECT DATEDIFF(mi, GetDate(), @.Weekend)/60.00 As Hours_till_Margaritaville|||Yes, a nice way to head off for the weekend.

No comments:

Post a Comment