Accessing A Java Class From Within SQL Server
Aug 21, 2007
I have a Java Class that I want to be able to access from within a SQL Server Stored procedure. I know you can access C# and other .Net code, but can you also access a regular Java class this way?
View 1 Replies
ADVERTISEMENT
Aug 21, 2007
have a Java Class that I want to be able to access from within a SQL Server Stored procedure. I know we can access C# and other .NET Framework code, but how can you access a Java Class?
View 1 Replies
View Related
Feb 6, 2008
I'm trying to connect to a sql server 2005 express edition but have some trouble with it: i can connect to sql server through eclipse IDE but when I create a jar and try connecting to server, I get the following error.
Exception in thread "main" java.lang.SecurityException: invalid SHA1 signature f
ile digest for com/microsoft/sqlserver/jdbc/SQLServerException.class
at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)
at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
at sun.security.util.SignatureFileVerifier.process(Unknown Source)
at java.util.jar.JarVerifier.processEntry(Unknown Source)
at java.util.jar.JarVerifier.update(Unknown Source)
at java.util.jar.JarFile.initializeVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
at sun.misc.Resource.cachedInputStream(Unknown Source)
at sun.misc.Resource.getByteBuffer(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
I'm using :
- os : winxp
- jdk1.5.0_06
- drivers : sqljdbc_1.1.1501.101 / sqljdbc_1.2.2828.100
is there anything i've missed? please, help me..
View 4 Replies
View Related
Nov 30, 2007
Hi,
Based on jax-ws 2.0 technology, I built a java client application to access a report via the web service interface of the SQL Server Reporting Services 2005.
I used the jax-ws "wsimport" tool to generate the java classes needed to call the web services (The class generation is based on the wsdl and I used this one http://serverName/reportserver/reportexecution2005.asmx?wsdl) and wrote the following sample code :
ReportExecutionService service = new ReportExecutionService();
ReportExecutionServiceSoap rs = service.getReportExecutionServiceSoap();
String reportPath = "HelloWorld";
String format = "MHTML";
String devInfo = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
Holder<byte[]> result = new Holder<byte[]>();
Holder<String> extension = new Holder<String>();
Holder<String> mimeType = new Holder<String>();
Holder<String> encoding = new Holder<String>();
Holder<ArrayOfWarning> warnings = new Holder<ArrayOfWarning>();
Holder<ArrayOfString> streamIDs = new Holder<ArrayOfString>();
try {
ExecutionInfo execInfo = rs.loadReport(reportPath, null);
rs.render(format, devInfo, result, extension, mimeType, encoding, warnings, streamIDs);
}
catch (Exception e) {
System.out.println( e );
}
The trouble is that an exception is caught on the call to the render method
javax.xml.ws.soap.SOAPFaultException: The session identifier is missing. A session identifier is required for this operation. ---> The session identifier is missing. A session identifier is required for this operation.
I found on the web (in C# examples) that this SessionId is supposed to be contained in the ExecutionId attribute of an
ExecutionHeader object. The ReportExecutionServiceSoap class (my rs object in the example) does not offer any way to directly set this SessionId or to associate an ExceptionHeader before calling the render method.
Have you ever tried - and managed - to do it.
Many thanks
View 18 Replies
View Related
Feb 21, 2008
Hai Guys,
I have a doubt Regarding SqlDataReader
i can able to create object to Sqlconnection,Sqlcomand etc...
but i am unable to create object for SqlDataReader ?
Logically i understand that SqldataReader a way of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited.
sqlDatareader belongs to which class is it sealed or static class?
can we create own class like SqldataReader .......
Reply Me ...... if any one know the answer..............
View 8 Replies
View Related
Feb 1, 2008
Does any one inherit SqlDatasource class?
I treid it as :
public class MYDataSource : System.Web.UI.WebControls.SqlDataSource
{public MYDataSource(){
}
}
Debugger dont give any error or warning when i buld project. But when i use it in a page Visual studio is crashed.
Can any one help me ?
View 1 Replies
View Related
Jul 23, 2005
Anyone have any tips for using Java against SQL Server? Our ITdirector is thinking of making us a Java shop, but I really would liketo stay with SQL Server as our RDBMS. We have Oracle Financials butour in-house development (currently VB6 client-server, soon to bereplaced by a service-oriented architecture based around Sonic andincluding SalesForce, both of which are Java) has been against SQLServer. He says five years ago at his old company Java/SQL Server hadlousy performance. I vaguely remember that since then Microsoft cameout with their own JDBC driver for SQL Server... Anyone have experiencewith this? Any performance tips will be hugely appreciated.TIA
View 10 Replies
View Related
Feb 6, 2007
What r the pros and conditions of using MSsql server ?
what the effect of data on the performance in case of MS SQL server?is it good enough tohandle data overloads?
how good the java ms sql server combo works in comparison to other databases !!
View 1 Replies
View Related
May 24, 2007
Hi,
I want to connect to sql server using java and want retrive data.
I am getting following exception:
[Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
My url
String url = "jdbc:microsoft:sqlserver://servername:6013/databasename";
please let me know if any thing wrong in my url.
Thanks,
View 1 Replies
View Related
Feb 18, 2004
How to connect to the named instance of SQL Server using Java?
I had the following code working fine(but with the default instance only)
SET JAVA_HOME=D:Program FilesJavaSoftJRE1.3.1_03
"D:Program FilesJavaSoftJRE1.3.1_03injava" -classpath Launcher.jar;Sprinta2000.jar;log4j.jar;activation. jar;mail.jar Launcher -Ddatabase -Uuser -Ppassword -Sserver:1433 -hlocalhost -p9900 -TTrue -VFalse -QK -QS
But the same code is failing with the named instance:
SET JAVA_HOME=D:Program FilesJavaSoftJRE1.3.1_03
"D:Program FilesJavaSoftJRE1.3.1_03injava" -classpath Launcher.jar;Sprinta2000.jar;log4j.jar;activation. jar;mail.jar Launcher -Ddatabase -Uuser -Ppassword -Sserverinstance:1434 -hlocalhost -p9900 -TTrue -VFalse -QK -QS
View 3 Replies
View Related
Feb 19, 2004
I have a java compiled jar file, which accept the connection string as follows: -Uusername -Ppassword -Sservername:port
This string works fine with the default instance of SQL Server, I mean as long as you supply the name of the SQL Server as 'SQLServer', but if I want to run it against the named instance of SQL Server like 'SQLSERVERNamedInstance' then the connection is failing, giving me the unknown host error. Any idea why?
View 3 Replies
View Related
Jul 20, 2005
Greetings All, I would be much obliged if anyone can point me to agood book on Java/JDBC and SQL Server.Regards, Louis.
View 1 Replies
View Related
Oct 23, 2007
Hi, Is there a special jdbc driver for SQL Server Compact Edition (2005) available? I'm getting error messages when trying to run java application on Pocket PC (Mobile 5.0):
java.lang.UnsatisfiedLinkError: java/sql/DriverManager.getCallerClassLoader()Ljava/lang/ClassLoader;
at java.sql.DriverManager.getConnection(Unknown Source)...
Mixxo
View 1 Replies
View Related
Aug 6, 2007
Hi, guys. It's the first time I connect a database.
My OS is windows XP.
I downloaded the sqljdbc on microsoft website and unzipped it.
Copy the sqljdbc_1.1 to the directory C:Program Files.
Modified the system variables:
classpath=.;%JAVA_HOME%libdt.jar;%JAVA_HOME%lib ools.jar;
%ProgramFiles%sqljdbc_1.1chssqljdbc.jar
JAVA_HOME=D:Program FilesJavajdk1.5.0_10
ProgramFiles=C:Program Files
I installed the sqlserver 2005and created a sqlserver db engine with windows authentification by default.
Using the management studio I created a database named BudgetAuthorization.
After that I created a user:
CREATE LOGIN aaron792 WITH PASSWORD='12345'
USE BudgetAuthorization
CREATE USER aaron792
Now I want to write a java application to access the database.
The application and the database are on the same computer.
I started the TCP/IP service, using the configuration manager.
Then use the eclipse to write the java application:
import java.sql.*;
public class TestJDBC
{
public static void main(String[] srg)
{
String driverName
= "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // Start JDBC
String dbURL = "jdbcqlserver://localhost:1433;
DatabaseName=BudgetAuthorization"; // Connect the server and the database
//String userName = "Administrator"; // windows user
//String userPwd = "password"; // windows login password
String userName="aaron792";
String userPwd="12345";
Connection dbConn;
try
{
Class.forName(driverName);
dbConn = DriverManager.getConnection(dbURL,userName,userPwd);
System.out.println("Connection Successful!");
// if successful print Connection Successful!
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
But it cann't be done!
The error information is:
Login failed for user 'aaron792'. The user is not associated with a trusted SQL Server connection.
I also tried the windows user, still failed.
What's wrong? Can anyone help?
Many thanks!
View 14 Replies
View Related
May 9, 2008
As in some of the databases stored procedures can be written in java. Java stored procedures run into inbuilt JVM of database.Does SQL server provides any support for writing stored procedures in java.Is there any inbuilt JVM in SQL server.
View 1 Replies
View Related
May 27, 2007
Hello, Everybody.
Help me please with one problem which I'm facing with while deploying java server application on my computer (this java app is jBilling). I have configured it as it was said in docs, I have added environment variable CLASPATH as Microsoft documentation said. I'm using SQL Server JDBC driver 1.2 by Microsoft. The result is that I find this message in log file:
2007-05-27 17:21:41,906 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.microsoft.jdbc.sqlserver.SQLServerDriver; - nested throwable: (java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.jdbc.sqlserver.SQLServerDriver))
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168)
... and so on.
I have copied sqljdbc.jar to lib folder of the server. That's how I specified connection string:
jdbc:microsoftqlserver://localhost:1434;DatabaseName=Billing;integratedSecurity=false;
Can not think out what to do else. Maybe somebody knows what to do about it?
Many thanks
View 1 Replies
View Related
Oct 4, 2006
Hey All,
I am having a problem connecting to a database I have with a java app I am creating for my senior project. I am using the latest MS JDBC for connecting to the SQL Server.
Below is the code I am trying to run:
try {
ds.setIntegratedSecurity(true);
ds.setServerName("localhost\SQLEXPRESS");
ds.setDatabaseName("*databasename*");
con =ds.getConnection();
} catch (Exception ex) {
ex.printStackTrace();
}
The ds and con variables are declared and initialized correctly. The error I am getting now is this:
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "*databasename*" requested by the login. The login failed.
Any suggestions on what I could be doing wrong?
View 4 Replies
View Related
May 15, 2006
I'm running into a problem where the class I'm running seems to eat up a lot of memory with sql server. When it's done running, the memory usage never goes down in taskmanager. I can't figure out where the memory leak might be. Here's the code that is being called. Does anyone see a reason why it would continue to eat memory as it runs and then not release it? Thanks.
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace QueryLoadTester
{
class JobSeeker
{
private string ConStr = @"Data Source=server;Initial Catalog=db;Integrated Security=True";
public JobSeeker() { }
#region UpdateJobSeeker
public void UpdateJobSeeker(string JobSeekerId)
{
string qry = "SELECT top 100 dbo.JobSeeker.JobSeekerID, dbo.JobSeeker.SiteId, dbo.JobSeeker.PositionTitle, dbo.JobSeeker.LocationID, dbo.JobSeeker.CurrentSalary, " +
"dbo.JobSeeker.DesiredSalary, dbo.JobSeeker.MinSalary, dbo.JobSeeker.CurrentHourly, dbo.JobSeeker.MinHourly, dbo.JobSeeker.Comments, " +
"dbo.JobSeeker.Resume, dbo.JobSeeker.WillRelocate, dbo.JobSeeker.DateAdded, dbo.JobSeeker.LastModified FROM dbo.JobSeeker " +
"where dbo.JobSeeker.Active=1 and dbo.JobSeeker.samplejobseeker=0 ";
if (JobSeekerId.Length > 0)
qry += " and dbo.JobSeeker.JobSeekerID=" + JobSeekerId;
qry += " and dbo.JobSeeker.JobSeekerID not in (Select JobSeekerId from JobSeekerFullTextSearch)";
SqlConnection cnInsert = new SqlConnection(ConStr);
SqlDataAdapter adp = new SqlDataAdapter(qry, cnInsert);
cnInsert.Open();
DataSet dsJobSeekers = new DataSet();
adp.Fill(dsJobSeekers);
adp.Dispose(); adp = null;
if (dsJobSeekers.Tables[0].Rows.Count > 0)
{
string jid = string.Empty;
string degree, degreegroup;
StringBuilder sb = new StringBuilder();
SqlCommand cmdInsert = new SqlCommand();
cmdInsert.Connection = cnInsert;
foreach (DataRow dr in dsJobSeekers.Tables[0].Rows)
{
jid = dr["JobSeekerID"].ToString();
if (JobSeekerId.Length > 0)
{
cmdInsert.CommandText = "Delete from JobSeekerFullTextSearch where JobSeekerId=" + JobSeekerId;
cmdInsert.ExecuteNonQuery();
}
DataSet dsExtras = GetJobSeekerExtras(jid, cnInsert);
SqlTransaction trans = cnInsert.BeginTransaction();
cmdInsert.Transaction = trans;
degree = degreegroup = string.Empty;
#region insert record into fulltextsearch
try
{
sb.Remove(0, sb.Length);
sb.Append("Insert into JobSeekerFullTextSearch (JobSeekerId, PositionTitle, LocationID, CurrentSalary, ");
sb.Append("DesiredSalary, MinSalary, CurrentHourly, MinHourly, CommentsResume, SiteId, WillRelocate, DateAdded, LastModified) values (");
sb.Append(jid);
sb.Append(",'");
sb.Append(dr["PositionTitle"].ToString().Replace("'", "''"));
sb.Append("',");
sb.Append("'");
sb.Append(dr["LocationID"].ToString().Replace("'", "''"));
sb.Append("',");
sb.Append(Nullify(dr["CurrentSalary"]));
sb.Append(",");
sb.Append(Nullify(dr["DesiredSalary"]));
sb.Append(",");
sb.Append(Nullify(dr["MinSalary"]));
sb.Append(",");
sb.Append(Nullify(dr["CurrentHourly"]));
sb.Append(",");
sb.Append(Nullify(dr["MinHourly"]));
sb.Append(",'");
sb.Append(dr["Comments"].ToString().Replace("'", "''"));
sb.Append(" ");
sb.Append(dr["Resume"].ToString().Replace("'", "''"));
sb.Append("',");
sb.Append(dr["SiteId"].ToString());
sb.Append(",");
sb.Append(Convert.ToInt32(Convert.ToBoolean(dr["WillRelocate"].ToString())));
sb.Append(",'");
sb.Append(dr["DateAdded"].ToString());
sb.Append("','");
sb.Append(dr["LastModified"].ToString());
sb.Append("')");
cmdInsert.CommandText = sb.ToString();
cmdInsert.ExecuteNonQuery();
#region dsExtras insert
//degree info
if (dsExtras.Tables.Count > 0 && dsExtras.Tables[0].Rows.Count > 0)
{
degree = dsExtras.Tables[0].Rows[0][0].ToString();
degreegroup = dsExtras.Tables[0].Rows[0][1].ToString();
if (degree.Length > 0 || degreegroup.Length > 0)
{
sb.Remove(0, sb.Length);
sb.Append("Update JobSeekerFullTextSearch set DegreeLevel='");
sb.Append(degree);
sb.Append("', DegreeLevelGroup=");
sb.Append(degreegroup);
sb.Append(" where JobSeekerId=");
sb.Append(jid);
cmdInsert.CommandText = sb.ToString();
cmdInsert.ExecuteNonQuery();
}
}
//disciplines info
if (dsExtras.Tables.Count > 1 && dsExtras.Tables[1].Rows.Count > 0)
{
sb.Remove(0, sb.Length);
foreach (DataRow d in dsExtras.Tables[1].Rows)
{
sb.Append(d[0].ToString());
sb.Append(",");
}
if (sb.ToString().Length > 0)
{
cmdInsert.CommandText = "Update JobSeekerFullTextSearch set DisciplineIdList='" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "' where JobSeekerId=" + jid;
cmdInsert.ExecuteNonQuery();
}
}
//industries info
if (dsExtras.Tables.Count > 2 && dsExtras.Tables[2].Rows.Count > 0)
{
sb.Remove(0, sb.Length);
foreach (DataRow d in dsExtras.Tables[2].Rows)
{
sb.Append(d[0].ToString());
sb.Append(",");
}
if (sb.ToString().Length > 0)
{
cmdInsert.CommandText = "Update JobSeekerFullTextSearch set IndustryIdList='" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "' where JobSeekerId=" + jid;
cmdInsert.ExecuteNonQuery();
}
}
//jobtypes info
if (dsExtras.Tables.Count > 3 && dsExtras.Tables[3].Rows.Count > 0)
{
sb.Remove(0, sb.Length);
foreach (DataRow d in dsExtras.Tables[3].Rows)
{
sb.Append(d[0].ToString());
sb.Append(",");
}
if (sb.ToString().Length > 0)
{
cmdInsert.CommandText = "Update JobSeekerFullTextSearch set JobTypeIdList='" + sb.ToString().Substring(0, sb.ToString().Length - 1) + "' where JobSeekerId=" + jid;
cmdInsert.ExecuteNonQuery();
}
}
#endregion
trans.Commit();
Console.WriteLine("Insert for " + jid);
}
catch (Exception exc)
{
trans.Rollback();
Console.WriteLine(jid + " - " + exc.ToString());
}
finally
{
trans.Dispose(); trans = null;
}
#endregion
dsExtras.Clear(); dsExtras.Dispose(); dsExtras = null;
}//end foreach
cmdInsert.Dispose(); cmdInsert = null;
}
cnInsert.Close(); cnInsert.Dispose(); cnInsert = null;
GC.Collect();
}
#endregion
#region GetJobSeekerExtras
private static DataSet GetJobSeekerExtras(string JobSeekerId, SqlConnection cn)
{
string qry = "Select JobSeekerDegree.DegreeLevel, VDegreeLevels.DegreeGroup from JobSeekerDegree inner join " +
" VDegreeLevels on JobSeekerDegree.DegreeLevel=VDegreeLevels.DegreeLevel where JobSeekerId=" + JobSeekerId + ";" +
"Select DisciplineID from JobSeekerDiscipline where JobSeekerId=" + JobSeekerId + ";" +
"Select IndustryID from JobSeekerIndustry where JobSeekerID=" + JobSeekerId + ";" +
"Select JobTypeID from JobSeekerJobType where JobSeekerID=" + JobSeekerId;
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(qry, cn);
adp.Fill(ds);
adp.Dispose(); adp = null;
return ds;
}
#endregion
#region Nullify
private static string Nullify(object p)
{
if (p != System.DBNull.Value)
return p.ToString();
else
return "null";
}
#endregion
}
}
View 5 Replies
View Related
Nov 3, 2015
How to encrypt the java application code using the 'with encryption' clause from sql server stored procedure or function.
View 3 Replies
View Related
Jan 8, 2008
Hi There!I have a big application which has two parts. A back-end developed in Deplhi 7 for desktop and a front-end developed in ASP.net C#. The problem I am facing is to integrate the login between both applications. I have a database that has the USER table with the PASSWORD encrypted and I've been already developed a Class Library with all the needs of Cryptography that has been used by the ASP.net application to authenticate users. The thing is, the desktop application has to authenticate the users too with the very same cryptography method, but Dephi cannot use dotNet assemblies (?). The client of the application ask to not use a web service and I'm trying to do this cryptography on the data base.The question is: Is there any way to invoke a dotNet Class Library through a SQL Server 2000 Stored Procedure?Consider that the Dephi developers had researched some ways to use dotNet assembly inside their application with no success. They had tried to develop their own cryptography method based on the algorithm that I had said them, but the encrypted string is different. Whenever the application try to match the strings, it doesn't work.Do you have some idea guys?Thanks in Advance! Ramon Silva
View 1 Replies
View Related
Mar 6, 2008
Dear all,
Our system is using .Net 1.1 and SQL Server 2000.
In our system, the timeout of SqlCommand is set to 300 seconds (~5 mins). However, there was a case that exception 'ThreadAbortException' was thrown in .Net (IIS Server), with its corresponding query was blocked over 11 minutes.
The case raised a question: 'Which party manages the timeout after the sql command is sent to DB? .Net, IIS Server or SQL Server?' If the timeout is managed by .Net or IIS, is there any setting making SQL Server 2000 possible to kill the aborted process earlier?
Thanks for helps.
Gabriel
View 1 Replies
View Related
Nov 13, 2007
I have a C# application, and I need to store instances of various class objects in a database. For Example:
myClass oMyClass = new myClass(args);
oMyClass.Property1 = something;
oMyClass.Property2 = something;
Now I need to store the oMyClass object in the database for later use, at which point I would get it out of the database, cast it back to myClass, and be able to acess its properties, etc. My problem is that the classes that I am working with are not serializable, so I cannot store the objects as XML. Does anyone have an example of doing this programmatically with C# and ADO.NET. I am assuming that I would have to store it in a vabinary column, but how do I get it in there. Any help would be greatly appreciated. Thanks.
Thomas
View 5 Replies
View Related
Jul 23, 2007
SP2 for SQL Server 2005 x64 has been less than happy for me.
The initial problem, mentioned in another thread, concerned SSIS client which stopped liking Data Flow components. It was solved by a removal and reinstallation of the client tools.
However, there now seems to be a problem with making use of the Teradata oledb provider within SSIS. Prior to the installation of SP2 there was no problem.
I create a new SSIS package
Add a Data Flow component
Within the data flow add an oledb source
Create a new connection - using the Teradata oledb provider
Test the connection (it works!)
Use SQL something like "select * from some_teradata_table_on_the_TD_server"
Click on columns, wait a second, a list of columns is returned
Add a SQL Server destination (with a new SQL Server connection)
Connect the two components
Save the package
Click go
The TD oledb source component turns bright red and the error is "class not registered"
I have uninstalled the TD oledb provider (and underlying TD components) and re-installed (32-bit and 64-bit) - no change
Any ideas?
- KjM
View 7 Replies
View Related
Jul 14, 2006
Hi,
I want to call a dll from Stored procedure developed in SQL Server 2005 at configuration level 80. but when I execute the stored procedure I get the following error.
Error Source: ODSOLE Extended Procedure
Description: Invalid class string
Code of stored procedure and vb.net class is given below:
VB.Net
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class PositivePay
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
' impersonate the calling user
Dim newContext As System.Security.Principal.WindowsImpersonationContext
newContext = SqlContext.WindowsIdentity.Impersonate()
Try
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
Catch Ex As Exception
Finally
newContext.Undo()
End Try
End Sub
End Class
===============================================================
STORED PROCEDURE
Create PROCEDURE [dbo].[PPGenerateFile]
AS
BEGIN
Declare @retVal INT
Declare @comHandler INT
declare @errorSource nvarchar(500)
declare @errorDescription nvarchar(500)
declare @retString nvarchar(100)
-- Intialize the COM component
EXEC @retVal = sp_OACreate 'PositivePay.class', @comHandler OUTPUT
IF(@retVal <> 0)
BEGIN
--Trap errors if any
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END
-- Call a method into the component
EXEC @retVal = sp_OAMethod @comHandler,'LogToTextFile',@retString OUTPUT, @LogName = 'D: ext.txt',@newMessage='Hello'
IF (@retVal <>0 )
BEGIN
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END
select @retString
END
View 6 Replies
View Related
Sep 7, 2007
I've just started getting this EXCEPTION_ACCESS_VIOLATION (0xc0000005) on machines using Windows 2000 sp4 connecting to SQLServer. This is crashing JVMs (multiple Sun versions and BEA also) in the Java VM frame (outside our code). This has just started recently - perhaps with the last set of patches? Has anyone else seen this or know what I could do to get more information? Could this be related to updates to named pipes?
Thanks!
-Brian Temple
View 5 Replies
View Related
Dec 12, 2006
I'm having a problem connecting with a Java application but I CAN connect using my .Net application - the user name and password are the same for both (using the same database on SQL Server Express 2005).
The error I get is: "com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "CORNERS" requested by the login. The login failed." An interesing note - I get the same message if the database is not running.
SQL Server Express 2005 is installed in mixed mode.
Here is my connection string in the .Net appplication: <add key="connectString" value="Server=(local);UID=sa;PWD=myPasswd;Database=CORNERS" />.
These are my values in my Java app web.xml -
<init-param>
<param-name>DBDriver</param-name>
<param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
</init-param>
<init-param>
<param-name>DBURL</param-name> <param-value>jdbc:sqlserver://localhostsqlexpress:1055;databaseName=CORNERS</param-value>
</init-param>
<init-param>
<param-name>DBUser</param-name>
<param-value>sa</param-value>
</init-param>
<init-param>
<param-name>DBPwd</param-name>
<param-value>myPasswd</param-value>
</init-param>.
And yes, the port is 1055 - I checked to find it.
I am using Microsoft SQL Server 2005 JDBC Driver 1.0 (sqljdbc_1.0.809.102).
Does anyone have any idea what is wrong so that the login fails in the Java application but works in the .Net application?
View 7 Replies
View Related
May 4, 2007
Hi
I have created a linked server from SQL Server 2005 (SP 1) to SQL Service 2000 (SP 4) with a sql server login that is available on both servers but with different passwords and permissions.
I am getting the following error while accessing the linked server in management studio based on the scenario given below ;
------ Error Message Starts
OLE DB provider "SQLNCLI" for linked server "(SQL Server 2000 instance name)" returned message "Communication link failure".
Msg 10054, Level 16, State 1, Line 0
TCP Provider: An existing connection was forcibly closed by the remote host.
Msg 18456, Level 14, State 1, Line 0
Login failed for user 'abc'.
------ Error Message Ends
Consider login name is abc.
Now this login abc has sysadmin rights on sql server 2005.
The same login abc has only db_datareader rights on sql server 2000 on just one database and is not associated with any fixed server role.
I have configured the linked server using the following options;
1. I have tried impersonating login from SQL Server 2005 to SQL Server 2000 .
2. I have also tried specifying remote login / password option.
Anyone having any idea, would be of great help.
Regards,
Salman Shehbaz.
View 3 Replies
View Related
Dec 10, 2004
Hi
If my site is hosted with an external company web host can I use ASP.NET pages to connect to a MS SQL DB that is on my company's internal server if I had MS SQL installed on it?
My company's server is always on and always connected to the internet.
I have access to my company's server if I need to set anything up on it for this to happen.
There will not be any kind of overload as the site is not accessed constantly.
Also, would this cause any kind of security leak? If so how would I go about plugging this hole?
Our server does have confidential info on it.
Cheers
kefi2927
View 1 Replies
View Related
Jul 9, 1999
I'm using OLEDB in my ASP code to connect to the SQL database. When I execute the page I got an error saying "438, Microsoft VBScript runtime error, Object doesn't support this property or method"
Anybody knows what this is in reference to.
I tested the same site in another server where IIS and SQL are in the same box and it's working fine.
Thanks for any input in this......
View 1 Replies
View Related
Jul 19, 2004
I need to write a VB app (VB6) to access and manipulate data within a MS SQL Sever 2000 database. I have experience doing this with MS Access. Is it much different/more difficult to do this with SQL Server?
Thanks
View 5 Replies
View Related
Nov 25, 2004
What is the easiest way to start executing SQL statements onto a SQL Server 2000 using C++ ?????
Are there any libraries or something I could use ?
View 2 Replies
View Related
Nov 6, 2007
Greetings. I am curently having problems with authorizations while attempting to connect to SQL Server with an Asp.NET web application. I will try to explain my problem as clearly as possible.
I am developing an Asp.NET web application with Visual Studio to connect and view a database on a remote SQL Server. In my Web.config file, I have added the line
<identity impersonate = "true"/>
In my IIS security options, I have disabled the annonymous authentication and enabled the Windows mode authentication instead. When accessing the database from my computer, by compiling and debugging my web application in Visual Studio, everything works wonder. When I try to use the web application from a remote computer using the IP address or from my own computer using localhost in the URL, it asks me for my Windows username and password, which I provide, and then refuses any further access, saying I don't have permission to even connect to the server.
How can I go around this and allow my users to connect to the server from a remote computer? My machine is running Windows XP SP2 and the server is running Windows Server 2003.
Thank you in advance for any help you may provide,
Marie
View 3 Replies
View Related
Dec 6, 2007
Hi,
I am developing a windows application that needs to communicate with a remote SQL server 2005 database. Server allows remote connections and MSDTC service also running. Do I need to run MSDTC service on the client machine where I use desktop application ? any ideas ? It's throwing some error like
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.
But my SQL Server allows remote connection, and I am able to do a select statement.
But when I insert/update anything, it's throwing this error. I guess some problem with MSDCT. Anybody have any idea ?
View 1 Replies
View Related