CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 Is there a way?

Print topic Send  topic

Author Message
Marilyn Miers
Posted: 03/12/2002, 8:43 AM

Dear People,

Is there a way I can specify my connection like the following traditonal
method using JSP instead of using the conection style of Common.jsp?
Format is as follows:

import business.*;
import java.sql.*;
import java.io.*;

/**
*This is a singleton class used to create a connection with the datatbase.
*/
public class DatabaseConnector {
//attributes
private static Connection con = null;

/**
*Private constructor which does nothing.
*/
//constructor
private DatabaseConnector() throws SQLException,ClassNotFoundException { }

/**
*Create only a single connection with the database.
*@return This is the Connection object.
*/
public static Connection getConnection() {
//catch exceptions
try{
if(con==null) {
//create connection
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:mShop2");
}
}
catch(SQLException e) {
System.out.println("Problems with loading");
}
catch(ClassNotFoundException e) {
System.out.println("Problems with loading db");
}
finally{
return con;
}
}
}

Any help will be greatly appreciated!


Alexey Alexapolsky
Posted: 03/13/2002, 2:14 AM

You may go Modules section/Common event,
obtain there generated code , and modify it as you want.

--
Alex
CodeCharge Developer


"Marilyn Miers" <mimaclit69@hotmail.com> wrote in message
news:a6lb6l$r8v$1@news.codecharge.com...
> Dear People,
>
> Is there a way I can specify my connection like the following traditonal
> method using JSP instead of using the conection style of Common.jsp?
> Format is as follows:
>
> import business.*;
> import java.sql.*;
> import java.io.*;
>
> /**
> *This is a singleton class used to create a connection with the datatbase.
> */
> public class DatabaseConnector {
> file://attributes
> private static Connection con = null;
>
> /**
> *Private constructor which does nothing.
> */
> file://constructor
> private DatabaseConnector() throws SQLException,ClassNotFoundException
}
>
> /**
> *Create only a single connection with the database.
> *@return This is the Connection object.
> */
> public static Connection getConnection() {
> file://catch exceptions
> try{
> if(con==null) {
> file://create connection
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> con=DriverManager.getConnection("jdbc:odbc:mShop2");
> }
> }
> catch(SQLException e) {
> System.out.println("Problems with loading");
> }
> catch(ClassNotFoundException e) {
> System.out.println("Problems with loading db");
> }
> finally{
> return con;
> }
> }
> }
>
> Any help will be greatly appreciated!
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.