Forums

PythonAnywhere on Data Sources and Drivers

I need to set up a connection to the database located on PythonAnywhere services via Data Source and Drivers functionality provided by JetBrains PyCharm Professional 2023. For reference, you can look at the attachement below. The problem is I can't undestand how the goal of mine can be achieved. In a way I even have some doubts if it's possible in the end. Please, give me an answer.

Also, I want to provide details about why I want to perform this linking. Each query I write is highlighted with a warning and the following message: "No data sources are configured to run this SQL and provide advanced code assistance. Disable this inspection via problem menu (Alt+Enter)". Of course, I understand that I am able to supress the message and voila but I don't think that supressing warning messages is a good practice. Data Sources and Drivers (PyCharm Professional 2023)

As you have a paid account, you can use an SSH tunnel to set up that connection; check out this help page, which has specific instructions for PyCharm.

Thank you for your reply. I have a paid account. However, after solving this problem, I've encountered another one. JetBrains has updated their UI so it looks like this and doesn't match the screenshot attached on the help page. I would appreciate your help in solving this conundrum.

enter image description here

What problem are you trying to solve now?

I have the instructions I need, but they're not up to date. I can't understand which fields to fill in and what data to put in them.

My steps are 1) Host: <on image>. 2) Username: Gladhedon (my username here) 3) Password: <password for logging into PythonAnywhere, not the database>.

HTTP/SOCKS proxy settings are not touched.

I now have a successful operation message in the window I showed you in the message above enter image description here.

But when I try to connect in the Data Sources and Drivers window, I get a 'connection refused' message.

enter picture description here

Are you sure that you are using the same credentials in both places?

Thank you. As far as I understand, you were right. The credentials set in the General tab were incorrect. Basically they were missing. But now there is another problem. It shows me this:

DBMS: MySQL (no ver.) Case: plain=mixed, delimited=exact [S1000] Packet for query is too large (4,739,923 > 65,535). You can change this value on the server by setting the 'max_allowed_packet' variable.

It doesn't make sense to change it because the maximum size of an IPv4 packet is 65535. I think there's something else causing this error... Or is there? If so, how can I do this on PythonAnywhere?

You are not able to change server config, so you need to change it on client side.

The Advanced tab has an option called maxAllowedPacket. Although its name is similar to max_allowed_packet, they are not the same. It's noted in the description of the field.

Maximum allowed packet size to send to server. If not set, the value of system variable 'max_allowed_packet' will be used to initialize this upon connecting. This value will not take effect if set larger than the value of 'max_allowed_packet'. Also, due to an internal dependency with the property "blobSendChunkSize", this setting has a minimum value of "8203" if "useServerPrepStmts" is set to "true".

I changed the MySQL driver version to 5.1, so the limit is higher.

enter image description here

Did you try to modify that setting?

Yes, I did. That's why I'm so confused. I am not sure if it is entirely dependent on the driver version I am using or not. This is my first experience with databases.

I'm not sure if PyCharm UI is the best place for first experience with databases.