Connection String trouble - database

This isn't so much a programming issue, but i'm not sure where else to get this level of expertise.
In any case, the issue i'm having is getting a legacy application to run locally on my machine. it connects to a SQL server using this connection string
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=UN;password=PW;Initial Catalog=DB;Data Source=IP
(where of course UN, PW, DB and IP are different, real, values)
I've changed it to this, to connect to a SQL Server Express instance on my local box:
Data Source=MY-PC-NAME\SQLEXPRESS;Initial Catalog=DB;Integrated Security=True
The app errors out with a generic cannot connect type error, which isn't helpful in the least bit.
Anyone have any advice? I don't have much more information on this blasted program ..

Try something like:
Provider=SQLNCLI10;Server=Server\SQLExpress;Database=myDataBase;Uid=myUsername; Pwd=myPassword;
VB6 used OLEDB syntax; your previous syntax was for .NET

This eventually worked Provider=SQLOLEDB.1;Persist Security Info=False;User ID=;password=;Initial Catalog=;Data Source=mypcname\SQLEXPRESS;Integrated Security=SSPI
I have no idea why. I needed to specify the integrated security.
Thanks for your help!

Related

Azure Function Database Connection

I have a Python package that I am able to run successfully on an Azure Data Science Virtual Machine. However, when I push it to Azure as a Function, I cannot successfully make a database connection. I was getting an error that the ODBC Driver 13 for SQL Server was not supported, so I changed the driver to ODBC Driver 17 for SQL Server and now I am NOT getting an error, but no data is being returned for a query that I know should return data.
Is there any other reason that data would not be returned? Firewall issues? do I need to add a binding? Do I need to separate out the connection string to feed each part (e.g., Driver, UID, PWD) into pyodbc.connect() separately? Right now I am feeding it in like this:
setting = os.environ("CONNECTIONSTRING")
conn = pyodbc.connect(setting)
This query works fine returning data when I run it on the VM using this code, just not as a Function.
(Note, this is different from my previous post regarding reading the Azure App Setting. That problem has been solved).
There are many parts where this could be breaking.
I'd suggest start by having a Profiler or Extended Events trace on your SQL Server to verify whether a connection is even being established. If not then you need to work through the the various points of connectivity to find out where it breaks. The identity, firewall, NSGs etc might all come into play here.
Once you see a connection then you can play with permissions to ensure that your query then returns your data.
Without a full picture of your infrastructure and settings it is hard to pin it down further.
Turns out it was not a database connectivity issue like I thought it was; it was a code error.

SQL Server Express Connection String - Unusual Parameter

I've inherited a web app, the local testing version has the following parameter on the end of its connection string:
;Database=ServiceDelivery;LastUser=sa
Can someone explain to me what "LastUser=sa" means? I know the sa account, but have never come across LastUser before.
Googling it hasn't produced any results.
It looks like it's not used any more:
http://www.installaware.com/forum/viewtopic.php?f=2&t=8597

Connection String for Oracle in OraDb11g_home1 Driver

I know that connection string questions are a dime-a-dozen, but I've got a new one.
I created a System DSN to talk to an Oracle database that I have locally on my machine. I put in all the info and hit the test button, and it says that it's successful. I'm using the OraDb11g_home1 driver.
When I try to put together a connection string for an application that uses ODBC, of course I can't get it to work.
One of the connection string attributes that they say that they require in their documentation is something called "Provider." What is this?
One of the most recent strings that I've used includes the following.
Driver={Oracle in OraDb11g_home1};Server=\\localhost:1521\local;Uid=mike;Pwd=password
Can anyone please offer any suggestions? Thanks,
mj
I figured it out. I was trying to use an application that was using 32-bit ODBC and the DSNs that I created were 64-bit.

Implementing container based security in tomcat using sql server 2005

I have been trying to implement container based security in tomcat 6.0 using sql server 2005. It worked fine using tomcat-user.xml file, but when i change the realm to sql server it throws an error. I have gone through almost everything on google, but no help. Can anybody please guide me to some sure shot path that will help me fix this problem. This is what my realm looks like
<Realm
className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
connectionURL="jdbc:sqlserver://mindfield-pc:1138;databaseName=College;user=sa;password=sa;SelectMethod=Cursor"
connectionName="sa"
connectionPassword="sa" digest="SHA"
userTable="Users" userNameCol="username"
userCredCol="password"
userRoleTable="Roles" roleNameCol="rolename"/>
I have checked that my sql server accepts sa username and password and NT Authority has been added to the security users. Any help would be highly appreciated.
Realm definition is really case-sensitive so make sure all values are in the correct case.
Good Luck!

How can I configure ScrewTurn Wiki to use SQL Server?

I'm trying to configure the excellent ScrewTurn Wiki product on my server, and haven't been able to make sense of the documentation.
I'd like to configure it to use SQL Server for storage. Do I still need to specify a valid value for the PublicDirectory key in web.config?
This is how I've tried to configure the connection so far, but obviously I'm missing something else:
<add name="WikiData"
connectionString="Data Source=xxx;Initial Catalog=xxx;User ID=xxx;Password=xxx"
providerName="System.Data.SqlClient"/>
I can't even get the page to load without complaining about the PublicDirectory key after adding this connection string. Before I added the connection string, the site came up fine without SQL Server implementation. I'm not even getting a chance to see if the DB connection works and don't know what to name it here, if the name makes any difference in the key.
How can I get this working properly?
figured it out, did not see the connection string section. resolved.

Resources