Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2005, 01:52 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default JDBC connection from ASP page

I am trying to write ASP code (vbscript) that uses ADO to create a database connection using a JDBC driver. I am not sure if this is possible. I have written a small java program which has successfully used the AS400 driver, but I cannot get the ASP page to work. This is the error I keep getting:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I have put the jt400.jar (the AS400 driver file from IBM) file in my CLASSPATH environment variable (Win XP), but the ASP code cannot seem to find the driver. I think it may be a problem with the CLASSPATH since the java code only works when I run it including the -classpath variable. My code is below. Has anyone done this before or know why it is not working? Also, the reason I am attempting this is for performance, since the ODBC AS400 driver is not that fast.

ASP Code: (does not work)

<%

ConnectionString = "DRIVER=com.ibm.as400.access.AS400JDBCDriver;URL={ jdbc:as400://SERVER/LIBRARY/USERNAME?user=xxxxxx&password=xxxxxx}"

set con = Server.CreateObject("ADODB.Connection")
con.open(ConnectionString)

mySQL="SELECT * FROM SLSPHY01"
set rstemp=con.execute(mySQL)

DO UNTIL rstemp.eof

subject = rstemp.Fields(0)
response.write subject & ""

rstemp.movenext

LOOP

rstemp.close
set rstemp=nothing
con.close
set con=nothing

%>

Java Code: (works)

import java.sql.*;

public class JdbcExample1 {

public static void main(String args[]) {
Connection con = null;

try {
Class.forName("com.ibm.as400.access.AS400JDBCDrive r").newInstance();
con = DriverManager.getConnection("jdbc:as400://SERVER/LIBRARY", "username", "password");


if(!con.isClosed())
System.out.println("Successfully connected to server...");

} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
JDBC connection failes using CrytstalReportWizard VanniPanni BOOK: Professional Crystal Reports for VS.NET 5 August 23rd, 2006 07:40 AM
Connection Problem with Java JDBC dontknowmuch SQL Server 2005 3 April 4th, 2006 01:51 PM
how do you configure jdbc connection saf01 Crystal Reports 0 September 12th, 2005 07:24 AM
Connection to Oracle via JDBC swaminathanb Java Databases 3 August 9th, 2005 06:37 AM
connection to oracle thru jdbc venkitaraman Java Databases 5 April 6th, 2005 06:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.