File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Can not connect to the database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can not connect to the database" Watch "Can not connect to the database" New topic
Author

Can not connect to the database

Johny Harris
Greenhorn

Joined: Jan 01, 2011
Posts: 3
Hii,

I have the following problem:
- I wrote a basic JSP Coding to save an User-Account (Login and Password) to the Database.
- I have 2 Inputfields in my JSP file (Logon+Password), the value of these Inputfields are given to a Bean.
- My Bean has the coding below:



My problem is, I can not estabilish a connection with the database with this coding. Manually I can start my database with the above values.
My other problem is, if I set a breakpoint somewhere in the method public void createConnection()... , my application is never stopping at this breakpoint, so I can not debugging my coding. But if I set a breakpoint somewhere else, I can debug my coding without any problems.

Can anybody help me?

Kind Regards,
Johny Harris
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

First, you should drop the 'newInstance()' from Class.forName(driverName).newInstance();

My other problem is, if I set a breakpoint somewhere in the method public void createConnection()... , my application is never stopping at this breakpoint

Where are you calling the createConnection() method? And how are you trying to debug this?

OCUP UML fundamental and ITIL foundation
youtube channel
Dinesh sikhwal
Greenhorn

Joined: Dec 07, 2010
Posts: 1
1. You have to drop the newInstance(); from the line 47
2. Remove dbName from this (DriverManager.getConnection(url + dbName, userName, passwort); ) because getConnection function takes only (URL,userName, Password)
3. create a main method in this class and make a call to the function that you want to debug....

Hope that helps you....

thanks
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Welcome to the Ranch, Dinesh.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not connect to the database