JDBC Connection

ei01

New Member
Messages
4
Reaction score
0
Points
0
So, I searched through both the x10hosting forums and around the internet and concluded that SQL databases hosted by x10hosting are compatible with JDBC (Java Database Connectivity). Assuming I am correct in my conclusion, I believe I am running into a problem with either the driver software on the vox server or into a problem with my logic. Below, there is an excerpt from the code I am using in a java applet hosted on my site (this applet is server-sided, which requires a database). Beneath the code excerpt, there is the error message I am experiencing. The error message is a stack-trace from Debug as Applet through Eclipse Juno.

Note: There are no problems with the other parts of the code, I have checked and narrowed it down to just this block of code being problematic.
Is it one of two things:
- I am using the wrong hostname for the database. If so, I need help formatting the hostname into how Vox formats database URLs for use in JDBC
- I am experiencing an issue with the driver (maybe there is no driver on vox which supports JDBC, although this is unlikely)

Code Excerpt (Java):
Code:
[SIZE=2]btnSignIn.addActionListener(
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ActionListener(){[/SIZE]
[SIZE=2]

            
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]            
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] actionPerformed(ActionEvent arg0) {[/SIZE]
[SIZE=2]
                String user = 
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]textField[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText();[/SIZE]
[SIZE=2]
                
[/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@SuppressWarnings[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"deprecation"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]
                String strpass = 
[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]passwordField[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText();[/SIZE]
[SIZE=2]
                
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] {[/SIZE]
[SIZE=2]
                    Connection con = DriverManager.[I]getConnection[/I](
[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"jdbc:mysql://eternalimperium.x10.mx/ei01_ucp"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"ei01"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"#######"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]
                    Statement st = con.createStatement();

                    String query = 
[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"SELECT pass FROM users where account='"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]+user+[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"'"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]
                    System.
[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]out[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2].println(query);[/SIZE]
[SIZE=2]
                    ResultSet rs = st.executeQuery(query);

     

                    
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](rs.next())[/SIZE]
[SIZE=2]
                    {

                        String dbpass = rs.getString(1);

                        
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](dbpass.equals(strpass)){[/SIZE]
[SIZE=2]
                        JOptionPane.[I]showMessageDialog[/I](
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Login Successful! "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Access Granted"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],JOptionPane.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]PLAIN_MESSAGE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]
                    }

                    
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]                    {

                        JOptionPane.[I]showMessageDialog[/I](
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Incorrect Password."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Access Denied"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],1);[/SIZE]
[SIZE=2]
                    }

                   }

                    
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]                    {

                        JOptionPane.[I]showMessageDialog[/I](
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"User not found."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Access Denied"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],1);[/SIZE]
[SIZE=2]
                    }

                } 
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (SQLException ex) {[/SIZE]
[SIZE=2]
                    JOptionPane.[I]showMessageDialog[/I](
[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"An internal error occured processing your request.\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] +[/SIZE]
[SIZE=2]
                            
[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"["[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ex.getErrorCode() + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"] "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ex.getMessage() +[/SIZE]
[SIZE=2]
                            
[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Internal Error"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],1);[/SIZE]
[SIZE=2]
                    ex.printStackTrace(); 
[/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Debug Mode ONLY[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]                }

                

            }

            

            

        });

[/SIZE]



Can anyone shed some light on this issue? Is JDBC supported by Free Hosting? If not, what level of Paid Hosting would I need in order to get JDBC driver support?
 

ei01

New Member
Messages
4
Reaction score
0
Points
0
Error Message (Debugger):
Code:
Code:
[SIZE=2][U][COLOR=#000080][COLOR=#000080]java.sql.SQLException
[/COLOR][/COLOR][/U][COLOR=#ff0000][COLOR=#ff0000]: No suitable driver found for jdbc:mysql://eternalimperium.x10.mx/ei01_ucp[/COLOR][/COLOR][/SIZE]
[SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]
    at java.sql.DriverManager.getConnection(Unknown Source)

    at java.sql.DriverManager.getConnection(Unknown Source)

    at com.eternalimperium.ucp.LoginPanel$1.actionPerformed(
[/COLOR][/SIZE][/COLOR][/SIZE][U][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]LoginPanel.java:84[/COLOR][/SIZE][/COLOR][/SIZE][/U][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000])[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

    at java.awt.Component.processMouseEvent(Unknown Source)

    at javax.swing.JComponent.processMouseEvent(Unknown Source)

    at java.awt.Component.processEvent(Unknown Source)

    at java.awt.Container.processEvent(Unknown Source)

    at java.awt.Component.dispatchEventImpl(Unknown Source)

    at java.awt.Container.dispatchEventImpl(Unknown Source)

    at java.awt.Component.dispatchEvent(Unknown Source)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

    at java.awt.Container.dispatchEventImpl(Unknown Source)

    at java.awt.Component.dispatchEvent(Unknown Source)

    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

    at java.awt.EventQueue.access$200(Unknown Source)

    at java.awt.EventQueue$3.run(Unknown Source)

    at java.awt.EventQueue$3.run(Unknown Source)

    at java.security.AccessController.doPrivileged(
[/COLOR][/SIZE][/COLOR][/SIZE][U][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]Native Method[/COLOR][/SIZE][/COLOR][/SIZE][/U][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000])[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

    at java.awt.EventQueue$4.run(Unknown Source)

    at java.awt.EventQueue$4.run(Unknown Source)

    at java.security.AccessController.doPrivileged(
[/COLOR][/SIZE][/COLOR][/SIZE][U][SIZE=2][COLOR=#000080][SIZE=2][COLOR=#000080]Native Method[/COLOR][/SIZE][/COLOR][/SIZE][/U][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000])[/COLOR][/SIZE][/COLOR][/SIZE]
[COLOR=#ff0000][COLOR=#ff0000]
[SIZE=2]    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

    at java.awt.EventQueue.dispatchEvent(Unknown Source)

    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    at java.awt.EventDispatchThread.run(Unknown Source)
[/SIZE][/COLOR][/COLOR]
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
You did see the part where it says that remote MySQL access is disabled, right? The only connection allowed is via localhost. MySQL is certainly compatible with JDBC, but only if you can connect to it—and since the servers here don't run Java, you can't use "localhost" as the server name, and therefore cannot connect.
 

ei01

New Member
Messages
4
Reaction score
0
Points
0
You did see the part where it says that remote MySQL access is disabled, right? The only connection allowed is via localhost. MySQL is certainly compatible with JDBC, but only if you can connect to it—and since the servers here don't run Java, you can't use "localhost" as the server name, and therefore cannot connect.

If I buy a premium package, is it possible to get a java driver running?
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Yes. Please see the plan comparison page and x10Premium.com plan level details for additional info. Note as well that you can get some extra performance/flexibility bang for your buck using an unmanaged VPS if you're up to the sysop tasks. And while the x10Premium offerings are far more liberal than the Free Hosting plans, the space is still primarily aimed at web site hosting, so if your primary aim is to have a remote database for a local-device application (desktop or mobile) and that application makes demands that interfere with other users on the server who are serving web sites from an x10Premium server, you'll be sitting rather lower on the totem pole than the others when it comes to problem resolution. That shouldn't ever be a problem on a VPS; increased traffic will simply mean increased latency for your app and shouldn't spill over to other users. Something to keep in mind.
 

ei01

New Member
Messages
4
Reaction score
0
Points
0
Yes. Please see the plan comparison page and x10Premium.com plan level details for additional info. Note as well that you can get some extra performance/flexibility bang for your buck using an unmanaged VPS if you're up to the sysop tasks. And while the x10Premium offerings are far more liberal than the Free Hosting plans, the space is still primarily aimed at web site hosting, so if your primary aim is to have a remote database for a local-device application (desktop or mobile) and that application makes demands that interfere with other users on the server who are serving web sites from an x10Premium server, you'll be sitting rather lower on the totem pole than the others when it comes to problem resolution. That shouldn't ever be a problem on a VPS; increased traffic will simply mean increased latency for your app and shouldn't spill over to other users. Something to keep in mind.

The database for my website also will be supporting a normal website (with a forum attached). The only use that the remote application has for a database is to grab and pull small bits of information (and when I say bits I mean literal binary bits for the most part). So, I don't expect latency to be an issue (it only grabs data at login and only inserts data into a shared database between a game and the User Control Panel, which is the remote application).
 
Last edited:
Top