How to add new Users into SQL server database through JAVA GUIHow can I restrict tables used in SQL Server database to Users from a Graphical User Interface?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to concatenate text from multiple rows into a single text string in SQL server?How to make a new List in JavaHow do I escape a single quote in SQL Server?SQL Server: How to Join to first rowHow do I UPDATE from a SELECT in SQL Server?How to drop a table if it exists in SQL Server?How to Delete using INNER JOIN with SQL Server?How to set user Windows password in SQL Server
“T” in subscript in formulas
Tex Quotes(UVa 272)
What are some interesting features that are common cross-linguistically but don't exist in English?
Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?
Is for(( ... )) ... ; a valid shell syntax? In which shells?
Showing that the limit of non-eigenvector goes to infinity
Lost property on Portuguese trains
How do I make my image comply with the requirements of this photography competition?
How do proponents of Sola Scriptura address the ministry of those Apostles who authored no parts of Scripture?
Why are non-collision-resistant hash functions considered insecure for signing self-generated information
Why doesn't 'd /= d' throw a division by zero exception?
How to determine car loan length as a function of how long I plan to keep a car
Why do gliders have bungee cords in the control systems and what do they do? Are they on all control surfaces? What about ultralights?
Change my first, I'm entertaining
Sum ergo cogito?
What to say to a student who has failed?
Was it ever possible to target a zone?
Most natural way to use the negative with つもり
How to respectfully refuse to assist co-workers with IT issues?
What is the difference between "Grippe" and "Männergrippe"?
Network helper class with retry logic on failure
"Sorry to bother you" in an email?
Why in most German places is the church the tallest building?
Why do banks “park” their money at the European Central Bank?
How to add new Users into SQL server database through JAVA GUI
How can I restrict tables used in SQL Server database to Users from a Graphical User Interface?Add a column with a default value to an existing table in SQL ServerHow to return only the Date from a SQL Server DateTime datatypeHow to concatenate text from multiple rows into a single text string in SQL server?How to make a new List in JavaHow do I escape a single quote in SQL Server?SQL Server: How to Join to first rowHow do I UPDATE from a SELECT in SQL Server?How to drop a table if it exists in SQL Server?How to Delete using INNER JOIN with SQL Server?How to set user Windows password in SQL Server
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am creating a GUI through Eclipse and am using Java; and the application connects to an SQL server database. I managed to add new users directly using Microsoft SQL server with their respective securables or restrictions.
However, I would like to add new users through the GUI itself and be able to determine which table they can access. Or at least just add new users and then ill figure out how to determine which table they can access. Im running into a problem converting the SQL code into Java, ( I am new to all this after all).
Thank you in advance,
Following is the SQL Code I found used in SQL Server to add new login and then a new User, the idea is to replace "NewAdminName" and "ABCD" with the actual user input directly from the GUI:
CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD'
GO
Use BEPAWI;
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName')
BEGIN
CREATE USER [NewAdminName] FOR LOGIN [NewAdminName]
EXEC sp_addrolemember N'db_owner', N'NewAdminName'
END;
Following is the JAVA code Im am currently working on with Eclipse:
JButton btnNewButton = new JButton("Enter");
btnNewButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent arg0)
try
String username = "";
String password = "";
username = UsernametextField.getText().trim();
password = PasswordtextField.getText().trim();
if (username.equals("")
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
);
I believe my problem is this line of code:
resultSetInt = statement.executeUpdate("CREATE LOGIN '"+username+"' WITH PASSWORD = ''"+password+"'' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N''"+username+"'') BEGIN CREATE USER ['"+username+"'] FOR LOGIN ['"+username+"'] EXEC sp_addrolemember N'db_owner', N''"+username+"'' END;) VALUES('"+username+"', '"+password+"');");
Maybe I have to add all the columns from the SQL table? such as the
sys.database_principals and FROM sys.server_principals
Thank you again,
java sql user-interface
add a comment |
I am creating a GUI through Eclipse and am using Java; and the application connects to an SQL server database. I managed to add new users directly using Microsoft SQL server with their respective securables or restrictions.
However, I would like to add new users through the GUI itself and be able to determine which table they can access. Or at least just add new users and then ill figure out how to determine which table they can access. Im running into a problem converting the SQL code into Java, ( I am new to all this after all).
Thank you in advance,
Following is the SQL Code I found used in SQL Server to add new login and then a new User, the idea is to replace "NewAdminName" and "ABCD" with the actual user input directly from the GUI:
CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD'
GO
Use BEPAWI;
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName')
BEGIN
CREATE USER [NewAdminName] FOR LOGIN [NewAdminName]
EXEC sp_addrolemember N'db_owner', N'NewAdminName'
END;
Following is the JAVA code Im am currently working on with Eclipse:
JButton btnNewButton = new JButton("Enter");
btnNewButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent arg0)
try
String username = "";
String password = "";
username = UsernametextField.getText().trim();
password = PasswordtextField.getText().trim();
if (username.equals("")
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
);
I believe my problem is this line of code:
resultSetInt = statement.executeUpdate("CREATE LOGIN '"+username+"' WITH PASSWORD = ''"+password+"'' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N''"+username+"'') BEGIN CREATE USER ['"+username+"'] FOR LOGIN ['"+username+"'] EXEC sp_addrolemember N'db_owner', N''"+username+"'' END;) VALUES('"+username+"', '"+password+"');");
Maybe I have to add all the columns from the SQL table? such as the
sys.database_principals and FROM sys.server_principals
Thank you again,
java sql user-interface
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55
add a comment |
I am creating a GUI through Eclipse and am using Java; and the application connects to an SQL server database. I managed to add new users directly using Microsoft SQL server with their respective securables or restrictions.
However, I would like to add new users through the GUI itself and be able to determine which table they can access. Or at least just add new users and then ill figure out how to determine which table they can access. Im running into a problem converting the SQL code into Java, ( I am new to all this after all).
Thank you in advance,
Following is the SQL Code I found used in SQL Server to add new login and then a new User, the idea is to replace "NewAdminName" and "ABCD" with the actual user input directly from the GUI:
CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD'
GO
Use BEPAWI;
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName')
BEGIN
CREATE USER [NewAdminName] FOR LOGIN [NewAdminName]
EXEC sp_addrolemember N'db_owner', N'NewAdminName'
END;
Following is the JAVA code Im am currently working on with Eclipse:
JButton btnNewButton = new JButton("Enter");
btnNewButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent arg0)
try
String username = "";
String password = "";
username = UsernametextField.getText().trim();
password = PasswordtextField.getText().trim();
if (username.equals("")
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
);
I believe my problem is this line of code:
resultSetInt = statement.executeUpdate("CREATE LOGIN '"+username+"' WITH PASSWORD = ''"+password+"'' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N''"+username+"'') BEGIN CREATE USER ['"+username+"'] FOR LOGIN ['"+username+"'] EXEC sp_addrolemember N'db_owner', N''"+username+"'' END;) VALUES('"+username+"', '"+password+"');");
Maybe I have to add all the columns from the SQL table? such as the
sys.database_principals and FROM sys.server_principals
Thank you again,
java sql user-interface
I am creating a GUI through Eclipse and am using Java; and the application connects to an SQL server database. I managed to add new users directly using Microsoft SQL server with their respective securables or restrictions.
However, I would like to add new users through the GUI itself and be able to determine which table they can access. Or at least just add new users and then ill figure out how to determine which table they can access. Im running into a problem converting the SQL code into Java, ( I am new to all this after all).
Thank you in advance,
Following is the SQL Code I found used in SQL Server to add new login and then a new User, the idea is to replace "NewAdminName" and "ABCD" with the actual user input directly from the GUI:
CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD'
GO
Use BEPAWI;
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName')
BEGIN
CREATE USER [NewAdminName] FOR LOGIN [NewAdminName]
EXEC sp_addrolemember N'db_owner', N'NewAdminName'
END;
Following is the JAVA code Im am currently working on with Eclipse:
JButton btnNewButton = new JButton("Enter");
btnNewButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent arg0)
try
String username = "";
String password = "";
username = UsernametextField.getText().trim();
password = PasswordtextField.getText().trim();
if (username.equals("")
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
);
I believe my problem is this line of code:
resultSetInt = statement.executeUpdate("CREATE LOGIN '"+username+"' WITH PASSWORD = ''"+password+"'' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N''"+username+"'') BEGIN CREATE USER ['"+username+"'] FOR LOGIN ['"+username+"'] EXEC sp_addrolemember N'db_owner', N''"+username+"'' END;) VALUES('"+username+"', '"+password+"');");
Maybe I have to add all the columns from the SQL table? such as the
sys.database_principals and FROM sys.server_principals
Thank you again,
java sql user-interface
java sql user-interface
asked Mar 27 at 18:18
Paul EamesPaul Eames
12 bronze badges
12 bronze badges
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55
add a comment |
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55
add a comment |
1 Answer
1
active
oldest
votes
Ok, so I figured it out. WOHOOO!!!
Im adding the code in case someone else needs it.
Now to figure out how to restrict certain tables to each new user....
Thank you,
try password.equals(""))
JOptionPane.showMessageDialog(null," name or password is wrong","Error",JOptionPane.ERROR_MESSAGE);
else
connection = DriverManager.getConnection(AdminMenu.DATABASE_URL, AdminMenu.UserName, AdminMenu.Password);
statement = connection.createStatement();
resultSetInt = statement.executeUpdate("CREATE LOGIN "+username+" WITH PASSWORD = '"+password+"'");
resultSetInt = statement.executeUpdate("IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'"+username+"') CREATE USER ["+username+"] FOR LOGIN ["+username+"] EXEC sp_addrolemember N'db_owner', N'"+username+"'");
//("CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName') BEGIN CREATE USER [NewAdminName] FOR LOGIN [NewAdminName] EXEC sp_addrolemember N'db_owner', N'NewAdminName' END;) VALUES('"+username+"', '"+password+"');");
String SMessage = "Record added for "+username;
// create dialog ox which is print message
JOptionPane.showMessageDialog(null,SMessage,"Message",JOptionPane.PLAIN_MESSAGE);
//close connection
((java.sql.Connection)connection).close();
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
}
});
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384067%2fhow-to-add-new-users-into-sql-server-database-through-java-gui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ok, so I figured it out. WOHOOO!!!
Im adding the code in case someone else needs it.
Now to figure out how to restrict certain tables to each new user....
Thank you,
try password.equals(""))
JOptionPane.showMessageDialog(null," name or password is wrong","Error",JOptionPane.ERROR_MESSAGE);
else
connection = DriverManager.getConnection(AdminMenu.DATABASE_URL, AdminMenu.UserName, AdminMenu.Password);
statement = connection.createStatement();
resultSetInt = statement.executeUpdate("CREATE LOGIN "+username+" WITH PASSWORD = '"+password+"'");
resultSetInt = statement.executeUpdate("IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'"+username+"') CREATE USER ["+username+"] FOR LOGIN ["+username+"] EXEC sp_addrolemember N'db_owner', N'"+username+"'");
//("CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName') BEGIN CREATE USER [NewAdminName] FOR LOGIN [NewAdminName] EXEC sp_addrolemember N'db_owner', N'NewAdminName' END;) VALUES('"+username+"', '"+password+"');");
String SMessage = "Record added for "+username;
// create dialog ox which is print message
JOptionPane.showMessageDialog(null,SMessage,"Message",JOptionPane.PLAIN_MESSAGE);
//close connection
((java.sql.Connection)connection).close();
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
}
});
add a comment |
Ok, so I figured it out. WOHOOO!!!
Im adding the code in case someone else needs it.
Now to figure out how to restrict certain tables to each new user....
Thank you,
try password.equals(""))
JOptionPane.showMessageDialog(null," name or password is wrong","Error",JOptionPane.ERROR_MESSAGE);
else
connection = DriverManager.getConnection(AdminMenu.DATABASE_URL, AdminMenu.UserName, AdminMenu.Password);
statement = connection.createStatement();
resultSetInt = statement.executeUpdate("CREATE LOGIN "+username+" WITH PASSWORD = '"+password+"'");
resultSetInt = statement.executeUpdate("IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'"+username+"') CREATE USER ["+username+"] FOR LOGIN ["+username+"] EXEC sp_addrolemember N'db_owner', N'"+username+"'");
//("CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName') BEGIN CREATE USER [NewAdminName] FOR LOGIN [NewAdminName] EXEC sp_addrolemember N'db_owner', N'NewAdminName' END;) VALUES('"+username+"', '"+password+"');");
String SMessage = "Record added for "+username;
// create dialog ox which is print message
JOptionPane.showMessageDialog(null,SMessage,"Message",JOptionPane.PLAIN_MESSAGE);
//close connection
((java.sql.Connection)connection).close();
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
}
});
add a comment |
Ok, so I figured it out. WOHOOO!!!
Im adding the code in case someone else needs it.
Now to figure out how to restrict certain tables to each new user....
Thank you,
try password.equals(""))
JOptionPane.showMessageDialog(null," name or password is wrong","Error",JOptionPane.ERROR_MESSAGE);
else
connection = DriverManager.getConnection(AdminMenu.DATABASE_URL, AdminMenu.UserName, AdminMenu.Password);
statement = connection.createStatement();
resultSetInt = statement.executeUpdate("CREATE LOGIN "+username+" WITH PASSWORD = '"+password+"'");
resultSetInt = statement.executeUpdate("IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'"+username+"') CREATE USER ["+username+"] FOR LOGIN ["+username+"] EXEC sp_addrolemember N'db_owner', N'"+username+"'");
//("CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName') BEGIN CREATE USER [NewAdminName] FOR LOGIN [NewAdminName] EXEC sp_addrolemember N'db_owner', N'NewAdminName' END;) VALUES('"+username+"', '"+password+"');");
String SMessage = "Record added for "+username;
// create dialog ox which is print message
JOptionPane.showMessageDialog(null,SMessage,"Message",JOptionPane.PLAIN_MESSAGE);
//close connection
((java.sql.Connection)connection).close();
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
}
});
Ok, so I figured it out. WOHOOO!!!
Im adding the code in case someone else needs it.
Now to figure out how to restrict certain tables to each new user....
Thank you,
try password.equals(""))
JOptionPane.showMessageDialog(null," name or password is wrong","Error",JOptionPane.ERROR_MESSAGE);
else
connection = DriverManager.getConnection(AdminMenu.DATABASE_URL, AdminMenu.UserName, AdminMenu.Password);
statement = connection.createStatement();
resultSetInt = statement.executeUpdate("CREATE LOGIN "+username+" WITH PASSWORD = '"+password+"'");
resultSetInt = statement.executeUpdate("IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'"+username+"') CREATE USER ["+username+"] FOR LOGIN ["+username+"] EXEC sp_addrolemember N'db_owner', N'"+username+"'");
//("CREATE LOGIN NewAdminName WITH PASSWORD = 'ABCD' GO USE BEPAWI GO IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAdminName') BEGIN CREATE USER [NewAdminName] FOR LOGIN [NewAdminName] EXEC sp_addrolemember N'db_owner', N'NewAdminName' END;) VALUES('"+username+"', '"+password+"');");
String SMessage = "Record added for "+username;
// create dialog ox which is print message
JOptionPane.showMessageDialog(null,SMessage,"Message",JOptionPane.PLAIN_MESSAGE);
//close connection
((java.sql.Connection)connection).close();
catch (SQLException se)
//handle errors for JDBC
se.printStackTrace();
catch (Exception a) //catch block
a.printStackTrace();
}
});
answered Mar 27 at 23:10
Paul EamesPaul Eames
12 bronze badges
12 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384067%2fhow-to-add-new-users-into-sql-server-database-through-java-gui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Instead of creating actual database users you could consider having a single user for the application and then modeling application users in tables where you store users, credentials, roles, permissions, etc. Also, you can consider avoiding making blocking calls from the GUI thread as it will block the interface. Separating GUI from business logic and data access is also a good idea.
– cjungel
Mar 27 at 18:35
Thank you for your reply Cjungel. I thought we separated all three logical models, we have the database with SQL server, the GUI where the user interacts and then the actual code itself, however we are new to this; and this is for school. If I understand correctly you are saying to just use one user to login into the server and then create a whole new table called users, depending on that table each user will have permission to the other tables? Also, there is no way of going forward with the way we are doing it?
– Paul Eames
Mar 27 at 21:55