cannot open MSSQL database in c# - javascript

I've a local html page that I'm working on. It's mostly HTML and Javascript and some aspx c#.
Whenever I am trying open the database, I get error:
System.Data.SqlClient.SqlException: Cannot open database "Database.mdf" requested by the login. The login failed.
Login failed for user 'ROYI\user'.
I searched a bit on the internet, and I've learned that this uses the windows authentication but it doesn't seem to work. I don't have a password for this db, so why can't it connect?
My connection string is:
"Server= localhost; Database=Database.mdf; Integrated Security = SSPI; ";
When I do:
SqlConnection conn = new SqlConnection(connString);
conn.Open();
I get the error on conn.open();.
Where is the problem with my connection string?

Related

NodeJS oracledb - ORA-03135: connection lost contact

I have a NodeJS application which uses oracledb library to connect to an Oracle Database . It's using the following code to try to connect to the database:
this.oracledb.fetchAsBuffer = [this.oracledb.BLOB];
const dbconfig = {
user: 'mysuser',
password: 'mypass',
connectString: '10.xxx.xx.xxx/MYORCLID'
};
console.log("Trying to get connection");
return await this.oracledb.getConnection(dbconfig);
But, I'm receiving the following error now during the "getConnection" method:
"Error: ORA-03135: connection lost contact"
Please, is there anything wrong with this code? It was working before but suddenly I started to receive the above message. From where should I start to check?
I've tried telnet and it worked too, so I'm not sure if this is a firewall issue.
I managed to solve the issue.
It was an internal blocking issue inside our network. They use a type of application which checks the origin hostname, linux user, application name and other properties before allowing access to the database.
After talking to my Infra and DB Team, they checked and liberated the access, and then everything worked as it should.
Thanks!

Google apps script connection problem with SQL Server

I have a problem in Google apps script connecting to a SQL Server database. Here is the code:
//Function to connect to ms sql server
function conn_test_server(){
var conn = Jdbc.getConnection("jdbc:sqlserver:\\ipaddress\instance:port",
"username", "password!");
}
//String formats i have used
//"jdbc:sqlserver://ipaddress:port/database"
//"jdbc:sqlserver:\\ipaddress\instance:port"
When I tried it an error is thrown that tells my to check the connection string, username and password.
I have triple checked them, as well the port seems open as I can connect through another app and also have whitelist the required IP's so the firewall does not stop them to connecting.
Please, if you could tell me other things I can look into to solve this error I would be very grateful.

Open outlook new mail window from server c#

I having a frunctionality in which user can select multiple product links and can choose an option to mail those links to anyone as a new outlook mail window will be opened. Everything is working fine on my local machine but on deployed link this functionality is not working and is throwing below exception:
Exception Message : System.Runtime.InteropServices.COMException
(0x80010001): Retrieving the COM class factory for component with
CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the
following error: 80010001 Call was rejected by callee. (Exception from
HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)).
I saw a couple of solutions for this like this and some code samples here but nothing helped me.
Also before going for the c# code for opening new mail window, i also tried doing it in javascript but got an issue there as well (here).
Please help !!
See sending mail through outlook is not done by server side it should be done in client Side..
To open a link in mail sending client you can do
Send Mail
This will automatically open mail sending client in user machine

Using local MySQL database with PHP & JavaScript on Google Maps

I am attempting to follow this tutorial - https://developers.google.com/maps/articles/phpsqlajax_v3
I have a rather fundamental & simplistic question.
Using firefox, I can see this error when I load the html page with the php and javascript built in, as taken from the tutorial above.
TypeError: xml is null
The MySQL database I have is on my computer and is not hosted on the website in question. So, when I run the php script that exports the xml in the command line, I can see that it functions correctly.
I attempted to add my ip address to the phpsqlajax_dbinfo.php file, such that -
<?php
$username="";
$password="";
$database="";
$host="";
?>
But this results in a connection error.
What changes do I need to make for this to be able to reference the database on my computer, rather than one on the site?
EDIT
I have verified that the host, database, password and username fields are correct. I am able to run the phpsqlajax_genxml.php file from the command line.
If you run MySql on your computer use "localhost" as a server in phpsqlajax_dbinfo.php:
$server="localhost";
Your MySql DB is probably not set up to listen to your public IP, if you really want to use your IP you can add it to my.cnf, but I would really recommend using localhost:
bind-address = your_ip

GCM and server side related issue

I'm currently trying out GCM on android with the DemoActivity project that I downloaded from android SDK. There are a couples of question regarding this whole GCM stuff. Correct me if I'm wrong.
Based on my understanding, what we needed to register the android device for GCM is just Sender_ID and Server_URL? Server_URL is based on the URL of my 3rd Party Application Server for example http://localhost:8080/gcm_test. As for Sender_ID is basically Google API's Project ID.
Do I need to send the registration ID from the android device to the server side and store it in server side database or something like that?
In order to send message from server to the android device, we needed API key and the android Registration ID?
How to configure on the server side in order to send message?
1)Right
2)Yes.You need that whenever you need to send a Push Notification to a particular device.The server identifies this device using a registeration id.
3)You need the Google App Id you got when you created the project and the registration Id you saved on the backed.
4)For ASP.NET look at this.
string GoogleAppID = "google application id";
var SENDER_ID = "9999999999";
//......
//......
AndroidGCMPushNotification apnGCM = new AndroidGCMPushNotification();
string strResponse =
apnGCM.SendNotification(devRegId,
"Test Push Notification message ");

Categories