• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JSP SQL server database connectivity

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I have this JSP code which works fine in Tomcat. But when I try to run it in JRun, it gives me an error:
ClassNotFoundException: jdbc:microsoft:sqlserver/SQLServerDriver()

Can you please help me?

I created the JDBC data source in teh JRun server. But I am a little un clear as to what I need to do in the JRun environment.

If any one has any samples (source code with database login etc and also instructions to create any data source in JRun) that would be great.

Thanks in advance for your help.

<%

out.println("test page");

try {

//DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());

Class.forName("jdbc:microsoft:sqlserver.SQLServerDriver()");

Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://<ipaddress> ORT","user","pass");

Statement stmt = connection.createStatement();

ResultSet rset = stmt.executeQuery("select ts_id from ttmaster_user.ts_labels");

while (rset.next()) {

out.println ("TS ID: " + rset.getString(1)); // Print col 1

}

stmt.close();

}

catch(SQLException e) {

out.println("SQLException: " + e.getMessage() + "<BR>");

while((e = e.getNextException()) != null)

out.println(e.getMessage() + "<BR>");

}

catch(ClassNotFoundException e) {

out.println("ClassNotFoundException: " + e.getMessage() + "<BR>");

}

%>
 
Marshal
Posts: 67496
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Other Servers forum.
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Verify your classpath. The problem is in the classpath.

bye for now
sat
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Class.forName("jdbc:microsoft:sqlserver.SQLServerDriver()");



That is not a class name, hence the driver class is not getting loaded.
 
Aparna Iyer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Can you please explain that? What do you mean by that is not class name? Can you please give me a sample and tell me how to load the driver class?
 
Aparna Iyer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satish, JRun admi says that the CLASSPATH is set properly. what shoukd he set the CLASSPATH to? Can you please send me the directory that he should include (I guess he already has the path where the mbase.jar file is, is there anything else he should add in class path for database connection?) Is there anything I should set?

Thanks in advance for your help Satish.
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am sure, your jdbc driver for sql server is not in the classpath. check again whether it is in the classpath.
I am not aware of the directory structure. Bcos I am not Using JRUN and SQL Server.
i will try to find the solution for your problem. give me some time

bye for now
sat
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Class.forName("jdbc:microsoft:sqlserver.SQLServerDriver()");

What do you mean by that is not class name? Can you please give me a sample and tell me how to load the driver class?



I mean exactly that: Class.forName takes as parameter a class name, and "jdbc:microsoft:sqlserver.SQLServerDriver()" is not a class name (it contains colons and parentheses). "jdbc.microsoft.sqlserver.SQLServerDriver" might be a class name; check the documentation of the driver, which you can find here
[ August 03, 2005: Message edited by: Ulf Dittmer ]
 
It's a tiny ad. At least, that's what she said.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic