This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi i am creating a desktop application, in which i have to login into sql server 2005 on the remote machine & have to create database, User etc, by using jTDS i am able to create connection to database as well as able to execute "SELECT" commnads but not able to execute database commands like- create database, create user etc.
The user you connect with does not have permission to create databases. Speak to your SQL Server admin.
Joined: Mar 28, 2011
yes I knew that, but my problem is that I have to prepare database on remote machine (which will be having SQL server 2005 installed on it and i have to login into that using window authentication) for the use of my application (creation of user and database) by using JDBC only.
can you please suggest how my user can be added to database as sysadmin role, or any other idea if you have? I think using SQL CMD it is possible but dont know how!!!
You don;t need a user in sysadmin role to create databases, the user just needs that specific operation granted to them. You can alter your user via T-SQL (run from Java code if needs be) but my guess is you will probably not have permission to do that either. Speaking to your database admin will speed this process up no end.