ADD ODBC database via batch file with Username/password - batch-file

I need to install an ODBC database on a few computers and was hopeing to do it all via a batch file. I can get it to install the database connection string like so.
ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=DSNNAME | Description=Descriptionname| SERVER=ServerName | Trusted_Connection=Yes | Database=dbname"
pause
#CLS
#Exit
But i need to add that it should log in with with an Login ID and password NOT with the network login ID.
Anyone know how i can fix this?
also its on 64 bit windows 7
Thanks

http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/53f689c1-53c8-45c6-b9ce-c44bce46cd9d/ says "Persistence of login credentials in a DSN is not supported (it's insecure). Using trusted connection would be the best way to achieve connecting without specifying credentials since the logged on user credentials is used for authenticating to the server."
If you change to Trusted_Connection=No it will add the DSN, but you'll then need to run the ODBC Data Source Admin and add the user and pwd to the new DSN by hand.
btw, according to http://msdn.microsoft.com/en-us/library/windows/desktop/ee388579%28v=vs.85%29.aspx "ODBCCONF.exe will be removed in a future version of Windows Data Access Components. Avoid using this feature, and plan to modify applications that currently use this feature."

Related

How to create user authentication in sql server 2008 using electron.js

sql connection can be done if we have correct user name, password & DB name. I want to create a user if pre defined user is not available. is there a way to do it perhaps during the installation process (installing the .exe) ? Maybe using a powsershell script
we can use thhis batch script https://gist.github.com/djangofan/3792028 with some changes.

SQL Server Linked Server with tnsnames.ora on network share - ORA: 12154

Having an issue getting a SQL Server linked server to Oracle working while using a tnsnames.ora file on a network share.
If I copy the tnsnames.ora file to the local server, the linked servers work fine. However, we keep the file on a network share. My sql service accounts have read access to the share. I configure TNS_ADMIN system variable to the network share, the linked servers no longer work. I get ora-12154: could not resolve the connect identifier specified. tnsping and sqlplus work on the server. When I use process monitor to investigate further, I see:
Operation: createFile
Result: ACCESS DENIED
...
Impersonating: domain\MyLogin
This seems like an issue, but is maybe a false positive? If a process is trying to impersonate my account and access a remote resource it will fail since we don't have Kerberos configured to handle double-hop.
SQLPlus and TNSPing work just fine with the network share configured.
I've looked at this post and tried the items that seemed relevant, but had no success.
Additional Info:
sqlnet.ora has this:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I am able to open a file browser as a service account and open the tnsnames file.
I had this same issue while trying to connect a oracle 10g database via my WCF serivce developed in .NET 4.0 framework.
I was having multiple instances of ORACLE installed in my system. So, I modified the ORACLE_HOME to point to the Oracle 10g and it worked.
Also check the following:
Your service name might have an alias, so Make sure that your listener is listening for the same service name that you are using and check for both local and global entries. Check:
$ORACLE_HOME/network/admin/tnsnames.ora
Check your global_name setting with this SQL:
select * from global_name;
Also, Please make sure you add the Key TNS_ADMIN in the registry and create a enviroinment variable with name TNS_ADMIN
Regedit->HKEY_LOCAL_MACHINE->Software->Oracle->RightClick NEW->StringValue and name
Specify the correct path where the oracle is installed for Example
X:oracleproduct32bit10.0.1.0.0NETWORKADMIN
Edit
The below video also looks quite helpful. Please check.
https://www.youtube.com/watch?v=Sec8WG8gQPg
As an Oracle DBA I sometimes have to work with Windows. Maybe you can adopt from my experiences with Oracle on Windows.
Scenario:
An Oracle DB runs under a domain user. I want to restore a database from a backup which is located on a Windows share (sounds like "read" but it obviously isn't). I (or let's say the windows team) did not manage to find the proper way to grant the required permissions.
After many tries, the admins grant "everything" to the entire Oracle server.
Even though the Oracle process runs in a user context we did not find a set of permissions for the user only. Only the permissions for the entire server enabled the restore process to access the data.
From security point of view this is a horrible solution! But maybe it will help you to come closer to a solution (and if so, please share :-)).

SQL Server 2014 Unattended Install

I'm running through the SQL Server 2014 install wizard, stopping before I get to the final step and then trying to use the Configuration.inf file to do "silentInstalls" on multiple servers. But, in the wizard I set the services (Ex: SQL Agent, ...) to a domain user, which requires a password. That password information is not included in the Configuration.inf file, so the unattended install obviously fails.
Questions:
I have to use a domain user if I am going to be using replication and other resources that require the SQL Server to communicate with each other, right?
How do I include the password for the domain service user in the Config.inf file?
Thanks,
Chris
I don't know what else you're using, but you don't need to use a domain user for replication. You can use a SQL account if you'd like (the documentation says so).
For the password issue, take a look at the list of parameters you can pass setup.exe (here). You can mix and match parameters and a config.ini. As such, you can set it up such that all you specify via command line switches is the various passwords you'll need (assuming that the service account is the same between all of your installs).

how to tell if oracle database is installed on pc

i work for a company as java developer, they gave me laptop that was previously used by another person, to test my java application i need to have oracle on laptop and create some sample database with sample data. when I got the laptop i found that there is oracle installed on it, but i don't know if this is only oracle client or full oracle installation (server + client)
please can you tell me how to figure out if there is only oracle client on laptop or full database installation, plus i need to know if there is some default username and password so that i can access the database and create schema and tables in it, so that i can test my java application.
i thinking to see DBA but i thought of dropping a question here first, maybe i can solve the problem by myself
If it is an Oracle Client, it doesn't have bin/dbca
Oracle Home may indicate the installation's type. The default Oracle Home folder names are:
Oracle Database: dbhome_1
Oracle Client: client_1
Although to make sure, you should check the services looking for OracleServiceSID entry on Windows.
Run Command sqlplus on command prompt.
Check services of windows to know that the oracle database was installed on laptop or not.
Try to find oracle universal installer in all programs by this also you can get which version of database is installed.
Your second question is about default username/password
For this you can give username : "/ as sysdba".
It will not ask for password because it will authenticate thorugh OS authentication.
after login you can able to create new schema or user and tables.
You can check simply using command prompt. Open command prompt and type connect. Provide the username and password and press Enter. It will show "connected" if the database is in your system.
Username: system (default)
Password: (what you provided while installing)
Firstly goto my computer/ this pc and then click on
downloads option and see your app and check that Oracle
is available there or not.

How to override or workaround compiled DB connection info

I've faced a bit strange problem. There is a site client would like to duplicate on another domain name. Site is built on ASP(yes, old v1 ASP :( ) with SQLServer. Problem is that all the database operations, including connection information is compiled into a DLL library.
Is there a way to some how intercept, override or workaround this?
Platform:
Windows 2000 Server
SQLServer 7
ASP v1 (VisualBasic)
What a nightmare...
If you have control over the new database server, and the connection string references the database server by name, you could add a line in the hosts file which points the name of the old server to a new ip address. Then you still have to create a user with the same password on the new database server.
Yes! However, your new database name MUST be smaller or equal to the length of your old one. Simply open up the vb6 .dll in any Hex Editor and search and replace. Make SURE you do not change the length of the DLL or shift any bytes around.
Failing that, add a hosts entry to windows to redirect the connection.
Could it be that the application uses a DSN definition for the connection?
In Control Panel -> Administrative Tools open ODBC Data Source Administrator. Have a look at the System DSN tab. Does there seem to be anything listed there that is related to the application?
Before you hack your DNS or rename the server, be aware that the SQL Server client supports aliases specifically for this scenario: How to: Create a Server Alias for Use by a Client.
The SQL 2000 tool for configuring an alias is the Client Network Utility.
Do you have any configuration options at all from asp? Even dbname or the such? If so you might be able to use two separate servers for IIS and use a single db server. I'm afraid you might need to find the source or the guy who wrote it.
If you could figure out the connection string or DNS you might be able to do something.
You could write your own passthrough ODBC provider.

Resources