# Write to DB hangs

**URL:** <https://forums.foundationdb.org/t/write-to-db-hangs/2643>\
**Category:** Using FoundationDB\
**Created:** [April 9, 2021, 6:27am UTC](https://forums.foundationdb.org/t/write-to-db-hangs/2643 "2021-04-09T06:27:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulj](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@rahulj](https://forums.foundationdb.org/u/rahulj)\
**Post date:** [April 9, 2021, 6:27am UTC](https://forums.foundationdb.org/t/write-to-db-hangs/2643/1 "2021-04-09T06:27:05Z")

</div>

I am just starting with foundationdb and trying the hello world example.  
I build the source from the docker and able to create a new db and check its status via the fdbcli. Screenshot below.

 ![image](https://global.discourse-cdn.com/foundationdb/original/2X/2/2cb58271aeab5edf0c3dff5b4dd7a32fec7c565b.png)

Now when I try to run the hello\_world example below:  
1 import fdb  
2 fdb.api\_version(620)  
3 db = fdb.open()  
4 db[b’hello’] = b’world’  
5 print ‘hello’, db[b’hello’]

The code hangs at line 4 and never returns.

Any pointers on how to proceed?

---

<div class="post-metadata">

**Author:** ![ajbeamon](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ajbeamon/32/13_2.png) [@ajbeamon](https://forums.foundationdb.org/u/ajbeamon)\
**Post date:** [April 9, 2021, 11:14pm UTC](https://forums.foundationdb.org/t/write-to-db-hangs/2643/2 "2021-04-09T23:14:56Z")

</div>

Your client hanging at the point where it first tries to use the database implies that it is not successfully able to connect. The most common reasons for this would be:

1. You are using a different `fdb.cluster` file that doesn’t match the cluster
2. You are using a client library (e.g. `libfdb_c.so` on linux) that is not compatible with the cluster (they need to have the same major minor version, such as 6.2).

There are other possibilities as well, such your client being unable to reach the server over the network (less likely if you are running `fdbcli` from the same place) or an issue with TLS configuration.

It looks like your `fdbcli` run is getting its cluster file from the current working directory. Are you running your Python program from the same directory? If not, then it’s worth checking that the cluster file it’s loading has the same contents (see [Administration — FoundationDB 6.2](https://apple.github.io/foundationdb/administration.html#default-cluster-file)).

One other way you can get a sense for what’s happening is to turn on trace logging for your client:

```auto
import fdb
fdb.api_version(620)
fdb.options.set_trace_enable()
...

```

After you’ve terminated your program, you can check the log file (trace\*.xml) for events that suggest what is happening. If it can’t connect at all, I believe you’ll see a `ConnectionTimedOut` event. If it gets rejected for being incompatible, you’ll instead see something like `IncompatibleProtocolVersion`.
