Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DSNless connection to ODBC SQL Server database
Message
From
09/08/2005 10:08:50
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Miscellaneous
Thread ID:
01039083
Message ID:
01039536
Views:
22
I'd say try with VFP first but I see you don't have it. OK then at least you have internet + notepad:
<html>
<title>Check SQL Server</title>
<body>
<script language="JScript">
function CheckTable(dbcPath,dbfName)
{
  var strCn="Driver={SQL server};" + dbcPath;
  var strSQL = "select * from " + dbfName;

  var oConn = new ActiveXObject("Adodb.Connection");
  oConn.ConnectionString = strCn;
  oConn.Open;
  var oRS = oConn.Execute(strSQL);

  var lst="<TABLE border='1'><TR>";
  var Maxfields=5;
  var MaxRows=20;

  for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
  {
    lst += "<TH>";
    lst += oRS.Fields(i).Name;
    lst += "</TH>";
  }
  lst += "</TR>";

  var counter=0;
  while (!oRS.eof && counter < MaxRows)
  {
    lst += "<TR>";
    for (i=0;i<Math.min(oRS.Fields.Count,Maxfields);i++)
    {
      lst += "<TD>";
      lst += oRS.Fields(i).Value;
      lst += "</TD>";
    }
    lst += "</TR>";
    oRS.MoveNext();
    counter++;
  }
  lst += "</TABLE>";
  oConn.Close();
  tablelist.innerHTML = lst;
  return true;
}
</script>
<table>
<TR><TD>Connection string</TD><TD><input type='text' size='80' name='DBCLOCATION'></TD></TR>
<TR><TD>Select from</TD><TD><input type='text' size='80' name='TABLENAME'></TD></TR>
</TABLE><HR>
<input type='button' value='List' onClick="CheckTable(DBCLOCATION.value,TABLENAME.value);return;">
<div id='tablelist'></div>
</body>
</html>
Save this as .htm and try your connection string. ie:

Connection string: server=1.2.3.4,1433;uid=me;pwd=password;initial catalog=pubs
Select from: authors

Here server is in the form of IP address:port number. With VPN I think hostname and Trusted_connection=yes would work for you wonderfully well.

Cetin

>I installed the MDAC 2.8 and still no help. But I found this in the Business Objects Knowledgebase which may be my problem. The following information was in a PDF file called cr_dbconn_troubleshooting.pdf
>
>Database Connectivity Troubleshooting for Crystal Reports Version 8.5
>Granted I am using Crystal Reports 11, but this might apply to me...
>
>Here is what the PDF technical paper said...
>
>Crystal Reports (CR) is a third-party report-writing tool. External factors may
>affect a successful connection to your database. These factors may include
>issues with the ODBC administrator, your database or a specific native (direct)
>driver.
>Often, it is necessary to perform several different tests and to answer a series of
>questions to isolate where the issue may exist. The troubleshooting process
>helps to narrow down the cause of the issue that you are experiencing.
>Record the answers of each of the troubleshooting questions. The answers can
>later be evaluated to help you narrow down what is causing the issue.
>1: If you are using a SQL-type database
>Examples of SQL-type database: Oracle, Microsoft SQL Server,
>Sybase, Informix, IBM DB2, Pervasive.
>
>HERE IS THE KEY QUESTION, which I could not answer "Yes" to the first part about the database client software installed on my hard drive...
>
>You must be able to answer ‘yes’ to the following:
>• Is the database client software installed? This needs to be installed
>on the local computer drive.
>• Is the database client software’s root directory (for example,
>‘C:\MSSQL\BIN’ for SQL Server) properly referenced in the
>computer’s search path?
>How to verify that the database client software's root directory is
>referenced in the computer's search path
>Crystal Reports Database Connectivity Troubleshooting FAQ
>10/7/2002 4:40 PM Copyright  2001 Crystal Decisions, Inc. All Rights Reserved.
>
>Page 4
>1. From the Start command, left-click Run. Type “command”
>or “cmd”.
>2. At the command prompt or DOS prompt, type “path”.
>This needs to be in the search path on your computer in order to load the
>appropriate driver dependency files.
>NOTE For further information, search for the following knowledge base article, C2008004, How
>to Check your Windows Search Path on our support site at
>http://support.crystaldecisions.com/kbase
>• Are you able to connect to the database through the database client
>software?
>(i.e. SQL Plus in Oracle)
>You must be able to connect to the database outside of Crystal Reports. If this
>does not work, you need to have your systems administrator or database
>administrator properly configure your computer.
>
>If this is true, then I need to get my client's SQL Server software installed on my PC, but I did not think that I needed it because I used a Connection String instead.
>
>I'll keep looking for answers. So far I cannot connect to the remote SQL Server database although I am connected to their remote server.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform