Showing posts with label connect. Show all posts
Showing posts with label connect. Show all posts

Friday, March 23, 2012

Getting Started - Connection Problem

I'm sure this has been asked previously and serached the forum with no luck. I'm using vb05-express to connect. I create the db in the folder the program executes from. The connection string is as follows;

Dim myCn As New SqlConnection

myCn.ConnectionString = "Server=.\SQLExpress;Database=TestDb.mdf;" & _

"Integrated Security=True;" & _

"Type System Version=Latest;" & _

"User Instance=True"

myCn.Open()

The error msg is;

Cannot open database "TestDb.mdf" requested by the login. Login failed for "machinename'\default.

Is this an authorization issue?

Appreciate any help you can provide

Hi,

Instead of using

Database=TestDb.mdf

instead use

AttachDbFilename=|DataDirectory|\TestDb.mdf

and the database will be copied and attached to the user instance. See the whitepaper on user instances at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp for more details.

Thanks

Sunday, February 26, 2012

Getting identity value

I am using ADO to connect to SQL 2k db. We have converted it to merge
replication and now I am not getting identity field value after I use the
Update method. For example:
rsPayInfo.AddNew
rsPayInfo("CheckAmt") = 100.00
rsPayInfo.Update
lngCheckID = rsPayInfo("CheckID")
The variable lngCheckID is returning a zero, which is not the actual value
on the new table entry. What do I need to do to retrieve the new CheckID?
Thanks.
Davidcheck the update command - it should be UPDATE ...; SELECT ...
to select the updated values
same for INSERT
David wrote:
> I am using ADO to connect to SQL 2k db. We have converted it to merge
> replication and now I am not getting identity field value after I use the
> Update method. For example:
> rsPayInfo.AddNew
> rsPayInfo("CheckAmt") = 100.00
> rsPayInfo.Update
> lngCheckID = rsPayInfo("CheckID")
> The variable lngCheckID is returning a zero, which is not the actual value
> on the new table entry. What do I need to do to retrieve the new CheckID?
> Thanks.
> David
>
>

Friday, February 24, 2012

Getting Exception , please help !

Hi all,

I am using MSSQL Server 8.0 , and the driver jtds.jar to connect the database for SQL operation .

I can do all the sql operation .
But after the creation of a trigger for a table , I used the same java program to insert rows into table .

---The java code I used -------
String connectionString = "jdbc:jtds:sqlserver://localhost:1433/master";
try {
Class.forName(jdbcDriverClass);
Connection con = DriverManager.getConnection(connectionString,userN ame,password);
Statement st = con.createStatement();
String query = "insert into tabname values('11','ROBERT')";
st.executeUpdate(query);
} catch (Exception e) { e.printStackTrace(); }
---------------

and got the exception

////////////////////////////////////////////////////////
java.sql.SQLException: executeUpdate can't return a result set
at net.sourceforge.jtds.jdbc.TdsStatement.executeUpda te(Unknown Source)
////////////////////////////////////////////////////////

What will be the problem here ?
Is it bcos of any time out ?
Please help !!!

ThanksPost the trigger.|||CREATE TRIGGER trigName ON tabname for
INSERT , UPDATE , DELETE
AS

DECLARE @.cont varchar(255)
DECLARE @.insRsltCount int
DECLARE @.delRsltCount int
DECLARE @.newVAL_0 char(10)
DECLARE @.newVAL_1 char(10)
SELECT @.insRsltCount = COUNT(*) FROM Inserted WHERE name IS NOT NULL OR num IS NOT NULL
SELECT @.delRsltCount = COUNT(*) FROM Deleted WHERE name IS NOT NULL OR num IS NOT NULL
IF(@.insRsltCount>0) AND (@.delRsltCount=0)
BEGIN
DECLARE INS_CURSOR CURSOR FOR SELECT name, num FROM Inserted
OPEN INS_CURSOR
FETCH NEXT FROM INS_CURSOR INTO @.newVAL_0,@.newVAL_1
WHILE @.@.FETCH_STATUS = 0 AND @.insRsltCount>0
BEGIN

SELECT @.cont = ' echo tabname.name="'+LTRIM(RTRIM(@.newVAL_0))+'" >>D://MyFolder//trigName.dat'
Exec master..xp_cmdshell @.cont
SELECT @.insRsltCount = @.insRsltCount-1
FETCH NEXT FROM INS_CURSOR INTO @.newVAL_0,@.newVAL_1


END
CLOSE INS_CURSOR
DEALLOCATE INS_CURSOR
END|||The usage of xp_cmdshell has been altered with the release of SP3 (SQL2K) and SP4 (7.0). From then on the security context is being verified within the procedure which is extended stored procedure, and if a user who caused (in your case) the trigger to fire does not belong to SYSADMIN server role, - the procedure will not execute.

Getting error, while trying to connect oracle

We are getting following error,while trying to connecct oracle using oledb provider.

Cannot retrieve the column code page info from the OLE DB provider. If the component supports the "DefaultCodePage" property, the code page from the propoerty will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page fromt he componnet's locale ID will be used.

Could you please tell me the reason for the error. is it problem regarding oracle client version installed on the system?

Thanks & Regards

S.Nagarajan

Are you sure its an error? Are you sure its not just a warning?

Did you try googling it? http://www.google.co.uk/search?hl=en&q=Cannot+retrieve+the+column+code+page+info+from+the+OLE+DB+Provider.+If+the+component+supports+the+%22DefaultCodePage%22+property%2C+the+code+page+from+that+property+will+be+used.+Change+the+value+of+the+property+if+the+current+string+code+page+values+are+incorrect.+If+the+component+does+not+support+the+property%2C+the+code+page+from+the+component%27s+locale+ID+will+be+used&meta=

This will definately help: http://blogs.conchango.com/jamiethomson/archive/2005/10/25/2303.aspx

-Jamie

|||

Thanks for your reply

Regards

S.Nagarajan

Getting error while running upgrade advisor on remote virtual server

Hi,

While connecting remote SQL server through upgrade advisor I am getting the below errors:

Error: Unable to connect to server. Reason: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Pls let me know if anyone has faced this issue and know how to fix.

Thanks in advance


-Shriniwas

just go to sql server surface area configuration and choose surface area configuration for services and connections then under mssqlserver-->database engine>choose remote connections and in right side page choose local and remote connections and using named pipes and tcp or 1st option with only tcp

Getting Error while connecting to Reporting Server

Hello,

I am trying to connect to my Reporting server. I get the following error message. Does any one get the same error and work around?

TITLE: Connect to Server

Cannot connect to RAJUVENKAT.


ADDITIONAL INFORMATION:

Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>
SQL Server Reporting Services
</title><meta name="Generator" content="Microsoft SQL Server Reporting Services 9.00.1399.00" />
<meta name="HTTP Status" content="500" />
<meta name="ProductLocaleID" content="9" />
<meta name="CountryLocaleID" content="1033" />
<meta name="StackTrace" content />
<style>
BODY {FONT-FAMILY:Verdana; FONT-WEIGHT:normal; FONT-SIZE: 8pt; COLOR:black}
H1 {FONT-FAMILY:Verdana; FONT-WEIGHT:700; FONT-SIZE:15pt}
LI {FONT-FAMILY:Verdana; FONT-WEIGHT:normal; FONT-SIZE:8pt; DISPLAY:inline}
.ProductInfo {FONT-FAMILY:Verdana; FONT-WEIGHT:bold; FONT-SIZE: 8pt; COLOR:gray}
A:link {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#3366CC; TEXT-DECORATION:none}
A:hover {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#FF3300; TEXT-DECORATION:underline}
A:visited {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#3366CC; TEXT-DECORATION:none}
A:visited:hover {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; color:#FF3300; TEXT-DECORATION:underline}

</style>
</head><body bgcolor="white">
<h1>
Reporting Services Error<hr width="100%" size="1" color="silver" />
</h1><ul>
<li>An internal error occurred on the report server. See the error log for more details. (rsInternalError) <a href="http://links.10026.com/?link=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsInternalError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00" target="_blank">Get Online Help</a></li><ul>
<li>Object reference not set to an instance of an object.</li>
</ul>
</ul><hr width="100%" size="1" color="silver" /><span class="ProductInfo">SQL Server Reporting Services</span>
</body>
</html>
--. (Microsoft.SqlServer.Management.UI.RSClient)


BUTTONS:

OK

Thanks!
Raju

Can you look in the ReportServer_<timestamp>.log file and see if there is any more information on what the error might be?

Also, have you run the RS configuration tool to see if there are any configuration problems?

-Daniel